Hi
I am having an issue with the concurrent() function. I have a SQL table (Using a SQL server connection) that has three fields which has to be updated when certain conditions are met. I use the UpdateIf function to update these. However when I use the UpdateIf in a Concurrent function to make all three UpdateIf's to run simultaneously I get an error. What am I doing wrong?
The function is:
Concurrent(
UpdateIf(
'[dbo].[MRP]';
And(
ParentGUID = Gallery1.Selected.ParentGUID;
IsBlank(Gallery1.Selected.ParentGUID) = false
// IsBlank(Gallery1.Selected.ChildGUID) = false
);
{Mål: DataCardValue6_1.Text}
);
UpdateIf(
'[dbo].[MRP]';
And(
ParentGUID = Gallery1.Selected.ParentGUID;
IsBlank(Gallery1.Selected.ParentGUID) = false
// IsBlank(Gallery1.Selected.ChildGUID) = false
);
{Afsnit: DataCardValue8_1.Selected.Text}
);
UpdateIf(
'[dbo].[MRP]';
And(
ParentGUID = Gallery1.Selected.ParentGUID;
IsBlank(Gallery1.Selected.ParentGUID) = false
// IsBlank(Gallery1.Selected.ChildGUID) = false
);
{Målnr: DataCardValue40.Selected.Value}
)
)
Solved! Go to Solution.
Please consider changing your Formula to the following:
UpdateIf(
'[dbo].[MRP]';
ParentGUID = Gallery1.Selected.ParentGUID;
{
Mål: DataCardValue6_1.Text;
Afsnit: DataCardValue8_1.Selected.Text;
Målnr: DataCardValue40.Selected.Value
}
)
What you are doing you can do with one UpdateIf. There is no need to perform three actions on the same record to update 3 columns.
Also, you can remove the And operation on the Gallery1.Selected.ParentGUID. If it is empty then this formula will simply do nothing. If it has a value, then it will perform as expected.
I hope this is helpful for you.
I think that patching the same datasource using concurrent probably "confuses" PowerApps. From the documentation on Concurrent():
You can't predict the order in which formulas within the Concurrent function start and end evaluation. Formulas within the Concurrent function shouldn't contain dependencies on other formulas within the same Concurrent function, and Power Apps shows an error if you try.
Hi Drrickryp
Thank you for a quick answer! Would it be possible to update the three fields using one UpdateIf function or anything similar, as essentially the three functions has the same If conditions?
I would recommend you to remove the concurrent function as this will try updating same items at one for different values based on the expression you shared. You can update your expressions to:
UpdateIf(
'[dbo].[MRP]';
And(
ParentGUID = Gallery1.Selected.ParentGUID;
IsBlank(Gallery1.Selected.ParentGUID) = false
// IsBlank(Gallery1.Selected.ChildGUID) = false
);
{Mål: DataCardValue6_1.Text}
);;
UpdateIf(
'[dbo].[MRP]';
And(
ParentGUID = Gallery1.Selected.ParentGUID;
IsBlank(Gallery1.Selected.ParentGUID) = false
// IsBlank(Gallery1.Selected.ChildGUID) = false
);
{Afsnit: DataCardValue8_1.Selected.Text}
);;
UpdateIf(
'[dbo].[MRP]';
And(
ParentGUID = Gallery1.Selected.ParentGUID;
IsBlank(Gallery1.Selected.ParentGUID) = false
// IsBlank(Gallery1.Selected.ChildGUID) = false
);
{Målnr: DataCardValue40.Selected.Value}
)
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Take a look at @mdevaney 's blog post. He has some ideas for how to speed up the process. https://matthewdevaney.com/patch-multiple-records-in-power-apps-10x-faster/
Please consider changing your Formula to the following:
UpdateIf(
'[dbo].[MRP]';
ParentGUID = Gallery1.Selected.ParentGUID;
{
Mål: DataCardValue6_1.Text;
Afsnit: DataCardValue8_1.Selected.Text;
Målnr: DataCardValue40.Selected.Value
}
)
What you are doing you can do with one UpdateIf. There is no need to perform three actions on the same record to update 3 columns.
Also, you can remove the And operation on the Gallery1.Selected.ParentGUID. If it is empty then this formula will simply do nothing. If it has a value, then it will perform as expected.
I hope this is helpful for you.
Check out new user group experience and if you are a leader please create your group
Did you miss the call?? Check out the Power Apps Community Call here!
See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.
User | Count |
---|---|
275 | |
257 | |
87 | |
39 | |
34 |
User | Count |
---|---|
340 | |
250 | |
131 | |
73 | |
48 |