web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to get the last en...
Power Apps
Unanswered

How to get the last entry of each unique item from SP

(0) ShareShare
ReportReport
Posted on by 9

Hi All,

I want to get the last record of each Tag (Only Lines with red cross at the front) and display them in a Gallery. My data are stored in a SP list.

I tried with ForAll loop but i didn't get the expected result.

 

Maybe someone could help me.

 

Thx for any help you will bring me.

 

Ycrad_0-1648211450691.png

 

Categories:
I have the same question (0)
  • Nogueira1306 Profile Picture
    7,390 Super User 2024 Season 1 on at

    I think that the only way is this:

     

    Set(varTagsAlreadyIn, "");

     

    ForAll(

    Sort(DataSource, ID, Descending),

    If(!(Tag in varTagsAlreadyIn),

     

    //IT IS THE FIRST ONE

    Set(varNewTag, varTagsAlreadyIn & " ," & Tag);

    Set(varTagsAlreadyIn, varNewTag),

     

    //IT IS NOT THE FIRST

    )

     

    I am creating 2 vars because you cant self reference in Power Apps.

    You can always try with Concat or Concatenate but I am not sure how to do it

     

    If you need additional help please tag me in your reply and please like my reply.
    If my reply provided you with a solution, pleased mark it as a solution ✔️!

    Best regards,

    Gonçalo Nogueira

    Check my LinkedIn!

    Buy me a coffee!

    Check my User Group (pt-PT)!

    Last Post on Community

    My website!

  • Ycrad Profile Picture
    9 on at

    Thank you Nogueira 1306 for your response,

     

    But it seems that Set function could not be called in ForAll function. The system returns an error and i don't know why... 😞 

  • Verified answer
    Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Ycrad 

    I disagree with the approach. Much simpler without variables:
     Use GroupBy(Sort(SPlist,ID,Descending),"Tag","Info") as your Items property of the gallery. 
    Then inside the gallery put labels with text property as "Tag", First(ThisItem.Info).Posted, First(ThisItem.Info).'Eqpt Name', etc.

  • Ycrad Profile Picture
    9 on at

    Dear Drrickryp,

     

    Thanks a lot for your answer. That is exactly what i was looking for.

     

    God bless U,

     

    Thank you.

     

     

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    happy.jpg

     

  • Ycrad Profile Picture
    9 on at

    Drrickryp,

     

    So, if i want to get between these unique last entries only those match with some criteria as TestStatus="Fail" or TestStatus="Succes" but DateDiff(Created;NextTest)<0 how can i Do?

    My Collection is called Lune :

    ClearCollect(Lune;GroupBy(Sort(Filter(TestsData;Site=CombSite_2.Selected.Title);ID;Descending);"TagEquipement";"Info"));

    When i tried to get the result into another Collection called LuneResult with :

    Clearcollect(LuneResult;Filter(Lune;Info.TestStatus="Fail" || (Info.TestStatus="Success" && DateDiff(Created;NextTest)))<0 ;

    I don't get the expected result.

     

    Could you help please ?

     

    Thank you.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard