Hi all, I have a gallery which I would like to start A-Z OnStart, but it isn't working for me.
This is the code I am using which puts the last updated item to the top of the gallery and allows me to sort the title A-Z with a button, however I would like the gallery to be sorted A-Z on start of the app as well.
If(varSortTitle,Sort(Filter([@'MIM - Customer Database'],CustomerSearch.Text in Title&ShortTitle),Title),Sort(Filter([@'MIM - Customer Database'],CustomerSearch.Text in Title&ShortTitle),Modified,Descending))
I tried Set(varSortTitle, true); OnStart which didn't work. Any help would be appreciated.
Thanks
Solved! Go to Solution.
Hi @Alison1 ,
And there lies your problem . . . you have used Set (a Global Variable) at App OnStart then UpdateContext on the screen - they are actually two separate Variables, with the Context Variable taking precedent on the screen it belongs on. Drop the one at App OnStart and put this OnVisible of the screen
UpdateContext({varSortTitle: true})
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
Hi @Alison1 ,
Do you have any other references to varSortTitle in the App - go to your left Search icon (bottom item) and look for it. Also put a label on the screen with varSortTitle and see if it says true or false. What is Title&ShortTitle ?
Hi @WarrenBelz
Thank you 🙂
This is my OnStart, I have a view variables
Set(varTabSelected,8);Set(varGalDefault,{}); Set(varShowLoginPopup, true); Set(varSortTitle, true);
Hi @Alison1 ,
And there lies your problem . . . you have used Set (a Global Variable) at App OnStart then UpdateContext on the screen - they are actually two separate Variables, with the Context Variable taking precedent on the screen it belongs on. Drop the one at App OnStart and put this OnVisible of the screen
UpdateContext({varSortTitle: true})
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
User | Count |
---|---|
253 | |
106 | |
94 | |
50 | |
39 |