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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / If statement in Patch ...
Power Apps
Unanswered

If statement in Patch function

(0) ShareShare
ReportReport
Posted on by 92

Hi,

 

I have a ForAll Patch and inside is an IF statement. This is a checkbox status. If the status is in "Created" and it is OnCheck then it should change it's status in "Ready". But my IF statement is not working. 

 

ForAll(
 SelectedItemsColl As sic,
 Patch(
 'Inspection Request Detail List',
 LookUp(
 SelectedItemsColl,
 ID = sic.ID
 ),
 If(Status.Value in "Created", {Status.Value: "Ready"},
 Status.Value in "Ready", {Status.Value: "In-Room"},
 Status.Value in "In-Room", {Status.Value: "Presented"},
 Status.Value in "Presented",{Status: Inactive, Status.Value: "Closed"}
 )
 
 )
 );

 

Can anyone help me to spot where I am doing it wrong? 🙂

 

Any helps really appreciated! Thank you.

 

Regards,

May

Categories:
I have the same question (0)
  • mdevaney Profile Picture
    29,991 Moderator on at

    @mayarnaldo 

    Do you have four checkboxes on the screen?  If you want to take an action when a checkbox is 'checked' then you should refer to that specific checkbox and determine if its true.  If yes, then change the status.

    Also, you may wish to reverse the order of your code to 

    • Presented
    • InRoom
    • Ready
    • Created

     

    ForAll(
     SelectedItemsColl As sic,
     Patch(
     'Inspection Request Detail List',
     LookUp(
     SelectedItemsColl,
     ID = sic.ID
     ),
     If(checkbox_Created.Value=true, {Status.Value: "Ready"},
     checkbox_Ready.Value=true, {Status.Value: "In-Room"},
     checkbox_InRoom.Value=true, {Status.Value: "Presented"},
     checkbox_Presented.Value=true,{Status: Inactive, Status.Value: "Closed"}
     )
     
     )
     );

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

     

     

     

  • mayarnaldo Profile Picture
    92 on at

    Hi @mdevaney ,

     

    Thank you for your reply.

     

    Yes, I have a checkbox and an arrow to help move:

     

    kanban_powerapps.png

     

    But still it give me error 😞

     

    Checkbox_complain.png

     

    Regards,

    May

     

  • mdevaney Profile Picture
    29,991 Moderator on at

    @mayarnaldo 
    I don't understand where the checkboxes for status are.  Can you please circle them on the screen?

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @mdevaney  Take a look at this post.  I believe it will shed some light on the problem that @mayarnaldo is having.

     

    @mayarnaldo you might want to take a look at my response there as it will simplify what you are trying to do tremendously. 

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

#2
11manish Profile Picture

11manish 224

#3
Valantis Profile Picture

Valantis 181

Last 30 days Overall leaderboard