I have the following scenario:
- In my app I want to display a gallery with a selection of entities
- The gallery must display (among other fields) the name of the user who created the item
- The last item in the gallery must be in view
For sake of illustration, let's say I want to display 'Accounts'. So, I add a Gallery to a screen and set the Items to "SortByColumns( Accounts, "createdon" )", and I add a label that displays ""Account name: "&ThisItem.'Account Name'&" -- Created by:"&ThisItem.'Created By'.'Full Name'". This works as expected. Now I want to set the last item into view, so I try setting the Default item to 'Last(Gallery1.AllItems)'. But, this doesn't work.
Next attempt: I initialize a local variable 'loadedAccounts' as such: 'UpdateContext({ accounts: SortByColumns( Accounts, "createdon" ) })'. Then I set the gallery source to 'loadedAccounts', and the Default to 'Last(loadedAccounts)' (*: note: it might take an intermediary variable that you can Blank() first in order for this to work in all cases). In this case, after loading the accounts, the 'proper' element is scrolled into view, but the user name stays empty!
Illustrated side by side:

My first question: in the first scenario, is there any way to set the 'Default' item in such a way that it works?
My second question: in the second scenario, why does the 'default' way of retrieving the user name not work, and how can I work around it?