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
)
)
I'd appreciate any help understanding what I'm doing wrong. Thanks!
Solved! Go to Solution.
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'}
)
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'}
)
That makes sense, thank you!
User | Count |
---|---|
122 | |
87 | |
86 | |
75 | |
67 |
User | Count |
---|---|
214 | |
181 | |
137 | |
96 | |
83 |