@iamcharlesac Sorry but this is wrong. Changing step 3 to change “Search for Day Summarys:first item” is what he had initially. This creates the race condition.
If you purely do a search for:first item in every step, they will execute at the exact same time. Step 3 will not wait for step 2 to finish, and step 2 will not wait for step 1 to finish.
If you’re changing the same thing in multiple steps in a workflow, you must always try to reference them without a search. It’s also heavier in terms of WU to search every step. After all, why would you search for the thing again, when you have it in the previous step? Step 3 should be to change (Step 1’s thing:plus item Step 2’s thing):first item.
@raenafay if you follow the below, i promise it will work as you think it should.
You should add an extra parameter to the workflow - current_days_summary. Type: day_summary. When executing the workflow, Do a search for todays day summary for the relevant user. If it exists, it will not be empty, if it doesnt exist, it will be empty. This is what we want.
Step 1 - Create new day summary - only if the workflows current_days_summary is empty. Do not input any values in this step, purely create the thing if it doesn’t exist.
Step 2 - Thing to change is (workflows’s current_days_summary:converted to list:plus item step 1’s new day summary):first item. If you found a Day Summary when executing the workflow, it will update this. If not, it will update the newly created thing in step 1.
Execute step 2 as you had originally, updating values in this step only.
Step 3 - Update thing > Step 2’s Day’s Summary.
Execute step 3 as you have now, updating with the calculations. You should also try to reference the information just saved in step 2. Can you not calculate percentages using the previous steps updates? This will remove 12 searches from this step alone. Huge amount of WU thats not needed.
E.g. Step 3 protein_pct= step 2’s protein_g_total/(step 2’s protein_g_total+step 2’s fat_g_total+step 2’s carb_g_total)