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 / Understanding a Formul...
Power Apps
Unanswered

Understanding a Formula using Global Variables PowerApp created from Dataverse

(0) ShareShare
ReportReport
Posted on by
I have a PowerApp that was created using a Dataverse table. many, many years ago.  I did not create this app nor the dataverse and its contents.  I am trying to decipher what this formula using global variables is doing (shown at bottom).  When it was working properly, it took the last customer number, added one, and created a new customer number. Now, it is using the customer number 1544 for every newly created customer.  When I click on the Default Value, it is covered by the FX shading,but shows 1543 beneath the shade (pic1 & pic2).  I think it is using the global variable in this formula shown below, because when I search for this global variable called CustNumTemp, it opens this screen and highlights Next in sizing handles and Customer Number in Green. (pic3) My latest customer number is 1564, so the next added should be 1565.  It is worth mentioning that when this screen is completed, it goes to another screen where the user inputs job information and clicks Save.  This is the point at which the customer number is added to the table.  In the event that the user cancels, the customer information is saved, but no customer number is added, and the 1543 number reduces by 1.  I am so confused by this!

My current workaround is to alter the Customer Number Field in the Dataverse table when new customers are added.

I can't express enough how limited my knowledge of Global Variables, DataVerse, and this app is.  Any suggestions would be great! Thanks -Angi
 
Pic1
 
Pic2
 
Pic3
 
Global Formula:
SubmitForm(Form1);Set(varFormCust,ThisItem);Set(CustNumTemp,Value(DataCardValue35.Text));Navigate(JobNew);Set(varFormMode,FormMode.New);
Set(varJobItem,Mid(Last(Sort(Filter(Jobs,StartsWith(Number,Left(Text(varFormCust.'Customer Number'),4))),Number)).Number,6,5));
Set(varJobIter,If(Left(varJobItem,2) = Right(Text(Year(Now())),2),Right(varJobItem,3),"000"));
Set(varJobNo,Text(Value(varJobIter)+1));
Set(varJobNo,If(Len(varJobNo) = 1, Concatenate("00",varJobNo),Concatenate("0",varJobNo)))
I have the same question (0)
  • ronaldwalcott Profile Picture
    3,847 Super User 2025 Season 2 on at
    Where is the Customer Number value set in the form?

    It looks as if the idea was to only create a new customer if there is an associated job which needs to be added. The suppled code does not show how the temporary customer number is created nor how it is replaced with the official customer number.

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard