cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mj7
Helper I
Helper I

info gallery

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 🙂 

1 ACCEPTED SOLUTION

Accepted Solutions

@mj7 

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.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

11 REPLIES 11
RandyHayes
Super User
Super User

@mj7 

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.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@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 

@mj7 

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?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes the option 1 

@mj7 

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).

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes if is an excell list is the same?

@mj7 

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.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes  okeyy i will try,  but right now  in my items of the gallery i have this...

If(!IsBlank(vardatesort),SortByColumns(DOOR,"date",If(vardatesort=true, Ascending,Descending)),DOOR)

 

 

is with a variable, so i leave it and add what you told me? 

@mj7 

Yes, you would need to mix in the logic I provided for that to work. 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

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 Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (2,672)