HI @mahakala_
Regarding the network failure, you can try using Connection.Connected before the forall statement. This way, it will check your connection before going through the Patching.
If you want to execute another statement after the forall, you can use two options:
- Function Concurrent() allows you to execute several formulas at the same time.
- If you put ; between two functions, once the first is executed completely, the following function will proceed to be executed.
I think the final code you need is the following:
If(
Connection.Connected,
IfError(
Concurrent(
ForAll(
_CollectionA,
Patch(
Table1,
Defaults(Table1),
{Field1: Field1}
)
),
Notify(
"Success",
NotificationType.Success
),
Clear(_CollectionB),
Reset(_ControlName)
),
Notify(
"Something went wrong",
NotificationType.Error
)
),
Notify(
"Unable to connect, please check your network",
NotificationType.Error
)
)
With this syntax, we first check if the Internet connection is ok, if not, we display an error message asking the user to check the connection.
If the connection is ok, we proceed to execute the concurrent function with the forall() statement, the success notify, and the clear or reset statements. If this goes wrong in any way, the IfError() function will display the error message warning the user that something went wrong.
I tried this solution and the Connection.Connect statement does not work properly if using the web browser as i losses the connection and cannot continue evaluating anything within the app. However, if you are using PowerApps studio, or the mobile/tablet PowerApps app, it will work as intended.
Hope this is what you were looking for.