cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DineshPathak
Level: Powered On

How to use set or update context in ForAll function of PowerApps?

Hi everyone,

 

I am using ForAll funtion to interate through all records of gallery to identify if there is any blank row/field.

I need to set a flag (using Set or UpdateContext) within ForAll loop and break loop if condition is met.

But ForAll does not seem to support Set Or UpdateConext.

Plaese advise:

  • How to set variable flag within ForAll in PowerApps
  • How to exit/break ForAll loop in PowerApps

Regards:

Dinesh Kumar Pathak

2 REPLIES 2
Super User
Super User

Re: How to use set or update context in ForAll function of PowerApps?

I don't think ForAll can do what you are asking. Maybe there is a different way to tackle your issue. What problem are you trying to solve with the ForAll?



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
Community Support Team
Community Support Team

Re: How to use set or update context in ForAll function of PowerApps?

Hi @DineshPathak ,

Please note:

Take care to avoid ordering dependencies. For this reason, you can't use the UpdateContext, Clear, and ClearCollect functions within a ForAll function because they could easily be used to hold variables that would be susceptible to this effect. You can use Collect, but the order in which records are added is undefined.

Here's a doc about it for your reference:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-forall

I suggest you express your views on PowerApps Ideas Forum. Your precious advice will be very helpful for our work.

https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas

About how to exit/break ForAll loop, since ForAll's usage is :The ForAll function evaluates a formula for all records of a table.

So it will excute for every records.

It syntax is : ForAll( Table, Formula )

So I suggest you add some conditions in the formula, which can limit the formula whether excute.

For example: (If statement)

ForAll(table,If(filedname<10,action1,action2))

 

Best regards,

Community Support Team _ Phoebe Liu

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Kudoed Authors (Last 30 Days)
Users online (5,083)