cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Click button and update/change dropdown value in gallery

 

Hi everyone,

 

I have a screen for managers with a gallery, a display form, and edit form. The gallery shows the status of purchases submitted that default to Open from an option set (Open, Pending, Approved, Declined). The display form displays all the purchase information from a gallery record for the manager to review. The edit form currently displays the status as a dropdown. I would like to:

1. Add two buttons (Approve and Decline) to the edit form. OnSelect I would like Approve to update the dropdown DDStatus to Pending and submit an update to the record with a pop-up or label verifying the change. Clicking Decline should set the dropdown to Declined and update the record. 

*Note: I can get the buttons to change a dropdown's values outside of a gallery using UpdateContext({Status: "Pending"}) but cannot get it to work inside of a gallery and can't figure out why yet.

 

2. The second thing I would like to do is filter the gallery based on status based on the buttons clicked. I have it partially working but the All button shows all status records (Open, Pending, Approved, and Declined) instead of just Approved and Declined records. 

 

I have the following:

All button: Set(ArchiveStatus, "All")

Approved button: Set(ArchiveStatus, "Approved")

Declined button: Set(ArchiveStatus, "Declined")

 

Gallery
Filter(
PURCHASE,
If(
ArchiveStatus = "All" || IsBlank(ArchiveStatus),
true,
ArchiveStatus = "Approved",
'PURCHASE Status' = [@'PURCHASE Status'].Approved,
ArchiveStatus = "Declined",
'PURCHASE Status' = [@'PURCHASE Status'].Declined
)
)

 

canvasapp.png

 

I'd appreciate any help understanding what I'm doing wrong. Thanks!

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hey brother,

My bad for not mentioning this. Make sure the argument you are using is a unique identifier. That way, it would try to find that record in the entity and update it's Purchase Status.

//Idk your unique identifier for Purchase but it should be ID or something like PURCHASE ID
UpdateIf(PURCHASES, 'ID' = ThisItem.'ID', { 
    'PURCHASE Status': [@'PURCHASE Status'].'Pending'}
)

 

View solution in original post

4 REPLIES 4
Advocate III
Advocate III

Heyya brother!

I'd like to know what entity you are using, but this should work for you:

Place this code on the OnSelect property of your button within the Gallery.

UpdateIf(colOrders, Order = ThisItem.Order, { 
     'Status': [@'Status'].'Pending'
})


Just change the data source and the argument


Hi @ProjectVelox!

 

The data source is PURCHASES and the dropdown option set is PURCHASE Status.

 

i tried this but it doesn't seem to work 
UpdateIf(PURCHASES, 'PURCHASE Status' = ThisItem.'PURCHASE Status',
{ 'PURCHASE Status': [@'PURCHASE Status'].'Pending'})

 

ThisItem gave an error but using ThisRecord did not. It still didn't seem to work even though the it looked like something was happening.

Hey brother,

My bad for not mentioning this. Make sure the argument you are using is a unique identifier. That way, it would try to find that record in the entity and update it's Purchase Status.

//Idk your unique identifier for Purchase but it should be ID or something like PURCHASE ID
UpdateIf(PURCHASES, 'ID' = ThisItem.'ID', { 
    'PURCHASE Status': [@'PURCHASE Status'].'Pending'}
)

 

View solution in original post

That makes sense, thank you!

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (5,774)