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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / setting a variable is ...
Power Apps
Answered

setting a variable is not allowed in "OnStart" App property

(0) ShareShare
ReportReport
Posted on by 413

Hi there. 

 

Coming back from vacations, my app gives me an error, 

This is the code that I've written in app property:

Set(ID_Last;First(Sort('T9 Segnalazione eventi macchina';Inizio;Descending)).ID);;

 

"Inizio" is a date/hour time field that you can translate with TimeStart: in my table, I need to check the most recend row in order to close that row (valuing a TimeEnd value) and create a new row with a new TimeStart.

 

Actually I have more than 5000 rows in my Sharepoint list. But in other apps (which are a copy of this one with the same code and the same columns in their tables) I reached 9000 and more rows.

 

The row data limit is actually set on 2000:

 

Calcioscacchi_0-1672758044723.png

 

 

 

Can you help? Thanks.

 

Categories:
I have the same question (0)
  • Verified answer
    Anchov Profile Picture
    1,986 on at

    Have you tried using the SortByColumns function?

    Set(ID_Last, First(SortByColumns(Demo, "Created", Descending)).ID)

     


    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

    Cheers!
    Rick Hurt

  • Calcioscacchi Profile Picture
    413 on at

    That seems to work. 

    Can I ask you the difference?

  • Anchov Profile Picture
    1,986 on at

    There are differences on how Sort and SortByColumns handles delegation:
    https://learn.microsoft.com/en-us/power-apps/maker/canvas-apps/delegation-overview#sorting-functions

  • Anchov Profile Picture
    1,986 on at

    If you are asking the difference between the two functions, to be honest, there is a bit of overlap between the functionality but:

    1. Sort - You can sort by columns but also can sort with more complex logic \ expressions. For example, if you wanted to add multiple columns together and then sort on the result.

    2. SortByColumns - You can only sort on the columns available in your data source.

     

    As seen, both functions are delegable, but there are more restrictions on the Sort function. So if you can get your needed functionality using SortByColumns function, that is the one I would use first.

    Source: https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-sort

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 392 Most Valuable Professional

#2
11manish Profile Picture

11manish 181 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 112 Super User 2026 Season 2

Last 30 days Overall leaderboard