Hi there,
I have a simple data set showing on the browse screen of my app that already has the default sort ascending descending button, the OnSelect command is UpdateContext({SortDescending1: !SortDescending1}). I have a text field on the screen that shows the date and time a record was added via the EditScreen and I would like to add a button to allow users to sort by date and time.
The text field that holds the date is named "Body1", so I tried putting "UpdateContext({SortAecending:Body1})" but I get a message saying there are side effects and it cannot be evaluated, does anyone have any advice for me?
Thanks,
Alan
Hi Delid4ve,
Many thanks for providing such detailed help. I am new to this and working on it in between other tasks so responses are slow - apologies. I will look at implementing your suggestions this evening, meantime I don't see gallery items in the property list to send you the code from. I built the app from an Excel file if that has any bearing on that?
Thanks again,
Alan
Hi @AlanR ,
Is this app auto-generated by PowerApps after you selecting Home > Start from your data? If so, then actually you can see how does the gallery being sorted and filtered, by selecting the gallery control and check its Items property:
In this screenshot, my BrowseGallery1 is sorted by "Days" column in my excel table. And search records that contain a string typed in search box in "Days" or "Name" columns.
If I want to sort with multiple columns, then I should change this formula to:
SortByColumns(Search([@Table1], TextSearchBox1.Text, "Days","Name"), "Days", If(SortDescending1, Descending, Ascending),"Name", If(SortDescending1, Descending, Ascending))
Regards,
Mona
Hi @v-monli-msft Mona,
Many thanks for the help and so sorry for the delay responding. I am new to apps so all of this is a bit complicated for me! I did build the app from the Excel data source as you thought, when I click on the BrowseGallery1 the attached is what I see.
Ideally I want to retain the search box functionality, have the records sorted by my Excel table field "Date of Incident" shown under the Body1 control on the screen shot, and keep the alphabetic sort option under the current sort up down button. How do I get rid of the "x0020" style references? Is there a consequence if I do?
Appreciate your time educating me on this,
Alan
Hi @AlanR ,
What is the column name inside your table? If it is Description of Issue, then you just need to use "Description of Issue" ( enclosed in double quotes) in the formula directly.
In which order do you want to sort with "Date of Incident" column? I assume that you want to sort with Descending, then you just need to replace the "If(SortDescending1, Descending, Ascending)" for this column to "Descending". For example, my formula should be:
SortByColumns(Search([@Table1], TextSearchBox1.Text, "Days","Name"), "Days", Descending,"Name", If(SortDescending1, Descending, Ascending))
Regards,
Mona
Hi Mona, @v-monli-msft
I have made some progress with your advice, thank you but I am still struggling with what I think should be a simple sort of records on the browse screen by date. My screen shot in the attached tries again to explain what I am hoping to do, can you review and let me know what you recommend?
Many thanks,
Alan
@mdevaney Hi mdevaney - this thread is the sorting by date problem I mentioned in my other post - monli was very helpful but I was not able to figure out the solution suggested, (likely just me being thick), can you help or clarify?
Alan
User | Count |
---|---|
175 | |
111 | |
86 | |
44 | |
42 |
User | Count |
---|---|
229 | |
118 | |
116 | |
74 | |
67 |