Hi. My issue is related to 3 of my source data columns:
I have set up my Gallery with a button which filters results by status. When the list is displaying "Open" items, the SortUpDown button sorts by Date perfectly. When the list is displaying "Closed" items, I want the SortUpDown button to sort by 'Date Closed', which is not working.
Here is my setup:
OnStart, I declare a global variable: Set(varStatus, true)
The button which filters results by status has this OnSelect property: UpdateContext({varStatus: !varStatus})
One of the labels in my gallery displays the date. The Text property on it is:
If(ThisItem.Status = "Open",Text(ThisItem.Date,"[$-en-GB]yyyy/mm/dd hh:mm"),Text(ThisItem.'Date Closed',"[$-en-GB]yyyy/mm/dd hh:mm"))
The original property was ThisItem.Date which is part of my issue.
When "Open" items are listed, the date displayed is Date.
When "Closed" items are listed, the date displayed is 'Date Closed'.
This is where I need the help
My Gallery Items property is:
SortByColumns(Filter(Main,If(varStatus,Status="Closed",Status="Open"), TextSearchBox1.Text in If(varStatus,'Date Closed',Date) || TextSearchBox1.Text in Location || TextSearchBox1.Text in Issue),"Date",If(SortDescending1,Descending,Ascending))
Where the column is specified as "Date", I need it to be "Date Closed" if the Status="Closed". That way it will sort by 'Date Closed' instead of Date, which is not valid on the "Closed" items screen. I have tried many If Statements which all seem logical to me but the problem is that it keeps telling me that "The specified column 'Date Closed' does not exist". I assume it is because the 'Date Closed' field was not added to my gallery, only Date.
So, do I need to add the 'Date Closed' field and simply hide Date when "Closed" items are displayed? Is there an easier way?
Solved! Go to Solution.
Hi @rwittels ,
Could you please share more details about the Items of the Gallery? Is that Main a collection?
If so, 'Date Closed' field is necessary to add into the collection then you could filter by that field. It would not be complex with the two fields:
1\ Use 2 Labels to display the respective field, Date:
Text(ThisItem.Date,"[$-en-GB]yyyy/mm/dd hh:mm")
and Date Closed:
Text(ThisItem.'Date Closed',"[$-en-GB]yyyy/mm/dd hh:mm")
2\ Make the 2 Labels overlap.
3\ Set Visible of the Date Label: !varStatus, Date Closed Label: varStatus
4\ Modify the formula in Gallery Items:
SortByColumns(Filter(Main,If(varStatus,Status="Closed",Status="Open"), TextSearchBox1.Text in If(varStatus,'Date Closed',Date) || TextSearchBox1.Text in Location || TextSearchBox1.Text in Issue),If(varStatus,"Date Closed","Date"),If(SortDescending1,Descending,Ascending))
Hope this helps.
Best regards,
Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.
Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.
Hi @rwittels ,
Could you please share more details about the Items of the Gallery? Is that Main a collection?
If so, 'Date Closed' field is necessary to add into the collection then you could filter by that field. It would not be complex with the two fields:
1\ Use 2 Labels to display the respective field, Date:
Text(ThisItem.Date,"[$-en-GB]yyyy/mm/dd hh:mm")
and Date Closed:
Text(ThisItem.'Date Closed',"[$-en-GB]yyyy/mm/dd hh:mm")
2\ Make the 2 Labels overlap.
3\ Set Visible of the Date Label: !varStatus, Date Closed Label: varStatus
4\ Modify the formula in Gallery Items:
SortByColumns(Filter(Main,If(varStatus,Status="Closed",Status="Open"), TextSearchBox1.Text in If(varStatus,'Date Closed',Date) || TextSearchBox1.Text in Location || TextSearchBox1.Text in Issue),If(varStatus,"Date Closed","Date"),If(SortDescending1,Descending,Ascending))
Hope this helps.
Best regards,
Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.
Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.
User | Count |
---|---|
206 | |
97 | |
60 | |
51 | |
45 |
User | Count |
---|---|
258 | |
158 | |
85 | |
79 | |
58 |