web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / can i set() on forall(...
Power Apps
Suggested Answer

can i set() on forall() or not ?

(1) ShareShare
ReportReport
Posted on by 2
hi i'm beginner for powerapp  trying to check condition in toggle input  by forall () in collection that keep toggle input like 
 
UpdateContext({check_result: true});
 
ClearCollect(
    ck_val,[
        {dt: tg_open.Checked},
        {dt: tg_close.Checked},
        {dt: tg_dis.Checked},
        {dt: tg_bt.Checked},
        {dt: tg_fn.Checked},
        {dt: tg_tp.Checked}
    ]
);
 
ForAll(
    ck_val,
    If(
        ThisRecord.dt = false,
        UpdateContext({check_result: false}) // it call cannot invoke on this function 
    )
);

 
Categories:
I have the same question (0)
  • Suggested answer
    SudeepGhatakNZ Profile Picture
    14,394 Most Valuable Professional on at
    The ForAll() function is not designed to return results directly in the same way a loop would in a traditional programming language. 
    Specifically, it doesn't allow you to modify the context or variables inside it in the way you're trying to do with. Try the following:
    
    // Initialize the context variable to true first
    UpdateContext({check_result: true});
    
    // Collect all the toggle values into a collection
    ClearCollect(
        ck_val, 
        [
            {dt: tg_open.Checked},
            {dt: tg_close.Checked},
            {dt: tg_dis.Checked},
            {dt: tg_bt.Checked},
            {dt: tg_fn.Checked},
            {dt: tg_tp.Checked}
        ]
    );
    
    // Check if any of the values in the collection are false
    If(
        !IsBlank(LookUp(ck_val, dt = false)),
        UpdateContext({check_result: false})
    )
    
  • WarrenBelz Profile Picture
    153,079 Most Valuable Professional on at
    Firstly, what @SudeepGhatakNZ has posted will work fine - another shorter version would be to set check_result directly so it will be true if all are checked, otherwise false.
    UpdateContext(
       {
          check_result: 
          tg_open.Checked && tg_close.Checked && tg_dis.Checked && tg_bt.Checked && tg_fn.Checked && tg_tp.Checked
       }
    ) 
     
  • WarrenBelz Profile Picture
    153,079 Most Valuable Professional on at
    Just following up to see if you received the answer you needed, or if you require further assistance.

    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard