cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ashok2
Post Patron
Post Patron

Gallery Items Patch

I had created Gallery with check boxes for each item and two buttons to approve and reject , where user select all or few check box and when click on Reject or approve all item who are checked will update approve or reject.

 

On Approve button i have written below condition which will update if its ,"Submit" to  "Completed",
"Completed" to  "Approve" and update ActionDate_1 and ActionDate_2 to current date when action taken  this piece of formula is working  fine,

ForAll(
RenameColumns(Filter(Gallery_1.AllItems,Checkbox3_1.Value),"ID","ID1"),
Patch(
SPLIST,
LookUp(SPLIST,ID=ID1),
{Status:{Value:
Switch(
LookUp(SPLIST,ID=ID1).Status.Value,
"Submit", "Completed",
"Completed", "Approve"
)
},
ActionDate_1:
Switch(
LookUp(SPLIST,ID=ID1).Status.Value,
"Submit", Today(),
"Completed", LookUp(SPLIST,ID=ID1,ActionDate_1)
),
ActionDate_2:
Switch(
LookUp(SPLIST,ID=ID1).Status.Value,"Completed", Today(),
"Approve", LookUp(SPLIST,ID=ID1,ActionDate_2)

)
}
)
)

 

On Reject button i have written below condition which will update if its ,"Submit" to  "RejectFirstLevel", and if it mark "Completed" from approve  condition then it can be RejectSecondLevel however in this Formula my ActionDate_1 will update from Approve  condition but will get disappear if condition is  "Completed", "RejectSecondLevel"

ForAll(
RenameColumns(Filter(Gallery_1.AllItems,Checkbox3_1.Value),"ID","ID1"),
Patch(
SPLIST,
LookUp(SPLIST,ID=ID1),
{Status:{Value:
Switch(
LookUp(SPLIST,ID=ID1).Status.Value,
"Submit", "RejectFirstLevel",
"Completed", "RejectSecondLevel"
)
},
ActionDate_1:
Switch(
LookUp(SPLIST,ID=ID1).Status.Value,
"Submit", Today(),
"RejectFirstLevel", LookUp(SPLIST,ID=ID1,ActionDate_1)
),
ActionDate_2:
Switch(
LookUp(SPLIST,ID=ID1).Status.Value,"Completed", Today(),
"RejectSecondLevel", LookUp(SPLIST,ID=ID1,ActionDate_2)

)
}
)
)

 

Let me know if you need further clarification i tried best to explain logic 

3 REPLIES 3
Ashok2
Post Patron
Post Patron

Any help in this issue ?
v-yutliu-msft
Community Support
Community Support

Hi @Ashok2 ,

I think you maybe forgot the process of turning "RejectFirstLevel " to  "RejectSecondLevel ".Please try to add this process in the if statement:

ForAll(
RenameColumns(Filter(Gallery_1.AllItems,Checkbox3_1.Value),"ID","ID1"),
Patch(
SPLIST,
LookUp(SPLIST,ID=ID1),
{Status:{Value:
Switch(
LookUp(SPLIST,ID=ID1).Status.Value,
"Submit", "RejectFirstLevel",
"Completed", "RejectSecondLevel",
"RejectFirstLevel", "RejectSecondLevel"
)
},
ActionDate_1:
Switch(
LookUp(SPLIST,ID=ID1).Status.Value,
"Submit", Today(),
"RejectFirstLevel", LookUp(SPLIST,ID=ID1,ActionDate_1)
),
ActionDate_2:
Switch(
LookUp(SPLIST,ID=ID1).Status.Value,"Completed", Today(),
"RejectFirstLevel", Today(),
"RejectSecondLevel", LookUp(SPLIST,ID=ID1,ActionDate_2)

)
}
)
)

 

 

Best regards,

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.

thank @v-yutliu-msft  for reply but  in my solution if it  "RejectFirstLevel" level it will not go to "RejectSecondLevel" however if status is "Completed"  then only RejectSecondLevel can take place . My ActionDate_1 get disappear 

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (2,690)