It seems like a very simple question, but how do you handle return values of f.e. COLLECT statements.
In my case I simply want to save a collection into another collection and if this works fine, then another collection shall be cleared!
Clear shall only be processed, if the first statement (COLLECT) is true or something ...
How would you do it?
This seems to work:
Collect(ResultCollection, Collect('[dbo].[Bestellung]', ToDB))
Please note that you should use ; instead of , if you are in a European locale
You can use the Errors function, that will return a collection with the errors from the last interaction with the data source. For example, in your case you could use the following expression:
Collect('[dbo].[Bestellung]'; ToDB);; If(CountRows(Errors('[dbo].[Bestellung]')) = 0); Clear(Einkaufskorb))
The Errors function would be great, but I have found it not always works as expected with Azure SQL / SQL Server.
Also, it is always more robust to have positive confirmation of a result (via return value) rather than negative return in case of error.
This is doubly true given the bugginess of the PowerApps to Azure SQL / SQL Server connector.
@Meneghino Good to know; I've used the Errors in an internal app and haven't had any problems yet, but it's used by a handful of people. If in the future you have a specific instance of the Errors function misbehaving, could you send us the session id for it? Thank you!
Check out new user group experience and if you are a leader please create your group
We are excited to announce that Demo Extravaganza for 2021 has started!
On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks
Don't miss the call this month on June 16th - 8a PDT