Hello together
I need to analyze data with a Power Automate Flow. The flow will be very extensive. To be able to manage intermediate results per analyzed record in the flow, I thought about defining a JSON object as follows:
{
"TotalTasks": 0,
"OcrLabels": 0,
"NotValidated": 0,
"NOk": 0,
"UTD": 0,
"Ok": 0,
"OverwriteUser": 0,
"NotAvailableUser": 0,
"OkSupervisor": 0
}
Above JSON Object is stored in a Variable called 'Validation'.
Now I want to access individual properties of the object at any point in the flow and, for example, increase the value by +1 or subtract -1, summarize intermediate some values, and so on... For increasing a property value by 1 I currently use the following line in a Compose Task:
setProperty(variables('Validation'), 'TotalTasks', add(variables('Validation')['TotalTasks'], 1))
In order for the value to be effectively stored in the object, I have to append a Set Variable Task after each Compose Task. If I want to update two values, I cannot append a Set Variable Task after the second Compose Task. No, I have to do a Set Variable directly after each Compose Task. This makes the flow extremely slow.
Is there a better solution to cache and edit data in the flow without having to store it in a DB or SharePoint or File?
Hi @Aedu ,
Because a variable do not support referencing itself at the same time in 'Set', I'm afraid we can only add a 'Compose' before the 'Set'. In addition, you can consider replacing object variables with multiple int variables, and then using increase and decrease actions.
Best Regards,
Bof
Michael E. Gernaey
566
Super User 2025 Season 1
David_MA
516
Super User 2025 Season 1
stampcoin
492