calculations in datalist

Fadsir78 shared this problem 13 days ago
In Progress

I have a data list with multiple columns and rows. The value in one field (in a specific column) is to be calculated from user's inputs in two other fields (in the same row). I managed to set it up by using "on change" or "lost focus" in each of the two fields. To do this, I needed to repeat the formula in each of the two fields, setting the value of the result field. I don't think repeating the formula is right way.

What I'm looking for is way to set the formula once, and get the result field updated when any of the two fields are updated on change or losing focus. No sure where this formula needs to be set, whether in the On Data Change of the row, or on page load etc. Or do I need to use a datamaster to do so?

Comments (10)

photo
1

If possible, can you attach the prototype here? We can take a look and see what might work best.

You can compress it to .zip/.rar format to attach it here.

photo
1

Please see attached two files, one with lost focus which works, and one with in data change, which does not work.

photo
1

Check out the attached prototype. Here's what we've changed:

We added an "On Focus Out" + "Data Master Action - Modify" event for each Input. Then, we added a Condition that will make sure that the events only trigger when the Inputs have been filled with a value.

photo
1

That's what I was saying, I have to repeat the formula in each input. What if I had 5 input fields? This is not efficient. There needs to be a way to have the formula in one location and get the output updated when any input changes.

photo
1

If you want to have the event triggered when you focus out of an Input then you'll need to repeat the event on each Input.

photo
1

Why on data change for the current row does not do the job instead? I. E. On data change set value of the result field to the multiplication of the other two fields. I tried but it does not work.

photo
1

"On Data Change" will only trigger when the Data Master has been altered. In the prototype you attached, you are only altering the Data List itself, but not the underlying Data Master. There might be a slightly more efficient way to sum the values, but ultimately you will need to repeat an event on each Input.

photo
1

Could you please provide example how On Data Change can be implemented in this case? Upon changing the input in a row, the input is to be saved to the datamaster, and then the result field is to be updated automatically due to the data change.

photo
1

I managed to resolve it guided by one of your published examples for flight status updated. Now I have the equation in the result field as a datamaster change triggerd by on data change, and I simple copy the value in each input field to the datamaster every time the input is changed.

I have to say I'm a bit disappointed as this is the second time that I face a problem and I don't receive a satisfactory response, then I have to go and find the solution by myself, taking out many days out of my project.

Regards,

photo
1

File attached