How to add 4 elements on a row to populate a 5th field
Hello, My group has four columns (below, acceptable, developed, exemplary) and we need to update a fifth field (total). We are trying to do this via Xpath. From the documentation we were a bit confused. We had the following: sum(below + acceptable + developed + exemplary) sum((below), (acceptable), (developed), (exemplary)) And we tried combination after combination to no hope. How do we successfully set up this task with an Xpath? Any direction would be great. If you need more clarity then let me know. I really appreciate it.
If you have an entity defined like this:
and want to set the value of the Combined attribute in a microflow Change Object Activity, you would do it this way:
However, I am not sure why you are using Xpath - maybe I don't understand what you are trying to accomplish.
below + acceptable + developed + exemplary
This will work as long as each of those 4 attributes is numeric.
If the calculation logic is always same, you can also try to use the Entity Before commit or Before create Events (as applicable). So, when you use the commit activity, you value for 5th column will be automatically committed to database and shown in page.
If you still want to do this from your page, I am not sure why you want to do an On Change for all four fields? If you have a Save action button at the end of the page, you can still get all four fields and sum up to the 5th one. Use onchange, only if you have any further manipulation to do based on the 5th column on the same page before committing.
In commit, make sure you also refresh the client, so when the page is loaded after Microflow, you see refreshed data.
For the user-experience it is nice to update the sum field on every change of the underlying attributes.
Don't know why you would want to solve it in the xpath. It totally works fine, even with an xpath data source in the way Mark explained.