Can someone please help me - this code was working fine only a few weeks ago!
//now save new orders
ForAll(col_current_tagprops,
//update the record with current disp_order
Patch('[dbo].[case_subtype_defprop]', LookUp('[dbo].[case_subtype_defprop]', case_subtype_defprop_pk = col_current_tagprops[@case_subtype_defprop_pk]), {disp_order:col_current_tagprops[@disp_order]});
);
Solved! Go to Solution.
Update:
Code below works, I just created a stored procedure to do the UPDATE and called that from Flow which is referenced below. Works fine. Weird.
//now save new orders
ForAll(col_current_tagprops As tagprops,
PowerAppsbutton_2.Run(tagprops.case_subtype_defprop_pk, tagprops.disp_order);
);
How is it not working? Is it not creating a new record, or are you getting some error? A couple initial thoughts, is it possible something in your data source has changed? Have you tried refreshing the datasource?
Other than these initial things to look at, I can't help you further but any additional details you can provide will help the next person who looks at your question.
Good Luck
It's silently not updating the record(s). I know it should be working because if I collect a field value from the ForAll collection into a new collection it fills nicely with the values I'd expect to see.
It's like the patch is just silently failing. I've tried deleting and re-adding datasource, using Refresh() function, and when I take the patch outside of the forall and give it absolute values it works fine.
For now i'll have to find a workaround I guess.
I'm also not sure why it is happening, or not happening to update. But as a guess try to use "As" it is described in this blog https://powerapps.microsoft.com/el-gr/blog/formulas-thisrecord-as-and-sequence/
Try this. At the end of your patch statement add:
Collect(SubmitErrors, Errors(col_current_tagprops))
Then on another screen, add a data table and the data source is SubmitErrors. Choose all the fields, you may get a red warning on the record field but it doesn't cause any issues.
I found this functionality recently and it has helped me as it captures submit error you might not otherwise see.
Many thanks @JR-BejeweledOne and @Anonymous,
tried both (code for @Anonymous fix below in case i'm doing it wrong), but again no update occuring in the database 😞
Can't see any errors - but thanks for the tips! good to know on both counts.
//now save new orders
ForAll(col_current_tagprops As tagprops,
//update the record with current disp_order
Patch('[dbo].[case_subtype_defprop]', LookUp('[dbo].[case_subtype_defprop]', case_subtype_defprop_pk = tagprops.case_subtype_defprop_pk), {disp_order:tagprops.disp_order});
);
Collect(SubmitErrors, Errors(col_current_tagprops))
Update:
Code below works, I just created a stored procedure to do the UPDATE and called that from Flow which is referenced below. Works fine. Weird.
//now save new orders
ForAll(col_current_tagprops As tagprops,
PowerAppsbutton_2.Run(tagprops.case_subtype_defprop_pk, tagprops.disp_order);
);
User | Count |
---|---|
250 | |
102 | |
94 | |
47 | |
37 |