hello i have a register that when i upload, it goes to another screen wich is the info that i already register so my question is how i can make that the information i registered goes to the info screen but on top of the gallery i alredy put a sort icon but i rather have the info un top so the user dont have to click the sort icon everytime. Hope you can help 🙂
Solved! Go to Solution.
Yes, that definitely is not going to work.
Use this formula instead:
DropColumns( SortByColumns( AddColumns(DOORTRIM, "FECHAYHORA",FECHAYHORA=Formdoort.LastSubmit.CÓDIGO, "NoOrdenar", true ), If(IsBlank(vardatesort), "NoOrdenar", "FECHAYHORA" ), Descending ), "FECHAYHORA", "NoOrdenar" )
Since you don't want any sorting if the vardatesort is empty, this formula sets a "dummy" column with true in it and then sort on that if it is blank. Otherwise it sorts on the date and time added column.
Not entirely sure from your description what you have, but it sounds like you want the most recent item at the top of the list.
If you are using SharePoint as your datasource, for this I would suggest sorting by the Created date or the Modified date.
I hope this is helpful for you.
@RandyHayesyes i have a gallery that has all the information of other screen and yes i want the most recent item on top but my data source is from an excel file and i already put a sort by the date but what i want is that automatically the item appear on top not bye clicking the sort
The position of records in your Gallery is going to be completely dependent on a sort. There is no way to just have new ones at the top. You will need to devise a strategy to sort in a way that returns the most recent at the top.
If your Gallery has a default sort of the dates descending, then the newest should always be at the top.
You have to ask yourself how would this work entirely - are you saying
Option 1 : If someone adds record A, then it would be at the top of the Gallery. Then if they add Record B, it would be at the top and now Record A would be someplace else within the list?
Option 2: Anything added during the session (App start to App end) would always appear at the top?
Option 3: Anything added Today would appear at the top?
Which meets the scenario you want?
In that case, I would suggest the following steps:
First, you will need something that uniquely identifies the record just added to your datasource. I do not know your columns or what you have, so I cannot suggest.
However, in the SharePoint world, we have an ID which is unique. So I will base the formula on that concept and you can adapt as needed for you app.
Change the Items property of your Gallery to the following (again this is based on the ID of a SharePoint list - adjust as needed):
DropColumns( SortByColumns( AddColumns(yourDataSource, "recent", ID=yourEditForm.LastSubmit.ID ), "recent", Descending ), "recent" )
This creates a boolean column and is true if the last submitted ID is the ID of the record. Then sorts by that true or false (true at top) and then drops the added column (as to not interfere with other app actions).
It is conceptually, but you need to have a unique identification of the record you submitted. Is there anything unique about the record submitted that would identify it? Again, in SharePoint, it is the ID. Perhaps you have something like that in your Excel or you have something else that would be unique - a Title, a date, a number, or a combination of them.
@RandyHayes okeyy i will try, but right now in my items of the gallery i have this...
is with a variable, so i leave it and add what you told me?
Yes, you would need to mix in the logic I provided for that to work.