I have the following formulas, to GroupBy the items by Title inside a gallery:-
ClearCollect(
colSource,
Filter(
'Grant Applications',
(CurrentState = "0" && Category.Value = "Solicited") || (CurrentState = "1" && Category.Value = "Unsolicited") || (CurrentState = "50" && Status.Value = "RejectOnly")
)
);
// Create a collection of all daily appointments
ClearCollect(
colGrants,
AddColumns(
ShowColumns(
colSource,
"ID",
"GrantTitle",
"Grantee",
"GrantAmountRequested_x0028_inUSD",
"Category",
"ApplicantEmailAddress"
),
"Level",
2
)
);
// Create a collection of all unique Title values
ClearCollect(
colGrantTitles,
AddColumns(
RenameColumns(
Distinct(
colSource,
GrantTitle
),
"Result",
"GrantTitle"
).GrantTitle,
"Level",
1
)
);
// Combine both collections into a single collection
ClearCollect(
colCombinedGrants,
colGrants,
colGrantTitles
);
//// *** NEW CODE ****
// Sort the combined collection
ClearCollect(
colSortedGrants,
SortByColumns(
colCombinedGrants,
"GrantTitle",
"GrantAmountRequested_x0028_inUSD",
"Level"
)
);
and beside each item we have Approve and Reject buttons, with the following onSelect property for the Reject button:-
Patch('Grant Applications',LookUp('Grant Applications',ID=ThisItem.ID),{
Status:{Value:"Rejected"},
CurrentState: "60"
}
);
so based on my first formulas, Rejected items should not appear in the gallery, but the issue we are facing is that when the user clicks on the Reject button the related item will still be shown, unless we refresh the browser. so is there a way to make my gallery more dynamic? as a workaround i am currently copying the first formulas to reconstruct the collection again after clicking on the reject button.. but is there a more accurate way of doing this? without having to reload the data each time a button is clicked?