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 / How to set a default v...
Power Apps
Answered

How to set a default value of Edit New Form only

(0) ShareShare
ReportReport
Posted on by 2

I am developing an app in Teams power app

 

I am trying to use the below code on the default value of edit form field by this code,

(First(Sort(TblSvcHistories, LineNo, SortOrder.Descending)).LineNo)+1
this I applied to bring the Last Value +1 for my counting's requirement
 

It works fine and bring the correct result, But keep value applied all the time. even in the other records. Till it is closed.

BUT I want to value to be brought only if the form is in NEW mode. I mean while entering the new record

tried by FormName.FormMode check, but not work.

 

Please guide a correct way to approach the same formula for the requirment

 

 

MIA27_0-1709873614623.png

 

MIA27_1-1709873752897.png

 

 

 

 

Categories:
I have the same question (0)
  • Samuel-Zhou Profile Picture
    393 on at

    Hi @MIA27 Try this code in Default,

    If(Form1.Mode=1,(First(Sort(TblSvcHistories, LineNo, SortOrder.Descending)).LineNo)+1)

     

  • MIA27 Profile Picture
    2 on at

    The code has not error, but the result is not required.

    For new it bring the calculation as required,

    But when the edit form is reset, or on the previous any old record, then record field value is blank, which it should not be.

    Requirement is if new then fetch the calculation, for rest no need, it to be remained as it,

    pls. check my below images and advise

     

    MIA27_0-1709877447505.pngMIA27_1-1709877459886.png

     

     

  • Verified answer
    Samuel-Zhou Profile Picture
    393 on at

    @MIA27 Try this,

    If(Form1.Mode=1,(First(Sort(TblSvcHistories, LineNo, SortOrder.Descending)).LineNo)+1,Parent.Default)

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 1,045

#2
Valantis Profile Picture

Valantis 675

#3
11manish Profile Picture

11manish 592

Last 30 days Overall leaderboard