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 / max id in sql server t...
Power Apps
Answered

max id in sql server table

(0) ShareShare
ReportReport
Posted on by

I'm simply trying to get the max  ID in a sql server table....this is getting the lowest number?

Using a lookup to get one single record.

 

 

;
Patch(
        '[dbo].[t_nsc_trackcode_trans_time_entry_pa]',
         Defaults('[dbo].[t_nsc_trackcode_trans_time_entry_pa]'),
          {
           NSC_ID_Ref: LookUp('[dbo].[t_nsc_trackcode_assigned_dd_DataEntry_pa]',ID_Racfid = lbl_Racfid.Text ,Max(Value(NSC_Id))),
           opened_at: Now(),
           inprogress_or_closed_at: Now()
          }
                                   )
;

 

Thanks

Dave

Categories:
I have the same question (0)
  • eka24 Profile Picture
    20,923 on at

    Please what are you trying to achieve with the Lookup and the max? 

    With Default in the Patch, are you adding new records?

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • Community Power Platform Member Profile Picture
    on at

    @eka24, I forgot to add the table name reference to the formula.

     

     NSC_ID_Ref: LookUp('[dbo].[assigned_DataEntry_pa]',ID_Racfid = lbl_Racfid.Text ,Max('[dbo].[t_nsc_trackcode_assigned_DataEntry_pa]',NSC_Id))

     

     

    dave

  • Verified answer
    mdevaney Profile Picture
    29,989 Moderator on at

    @Anonymous 

    This code returns only one Value since lookup is being used 

    LookUp('[dbo].[t_nsc_trackcode_assigned_dd_DataEntry_pa]',ID_Racfid = lbl_Racfid.Text ,Max(Value(NSC_Id)))

     

    You might want to try FILTER instead to look at many values then get the MAX result

    Max(Filter('[dbo].[t_nsc_trackcode_assigned_dd_DataEntry_pa]',ID_Racfid = lbl_Racfid.Text), Value(NSC_Id)) 

     

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

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 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard