Understanding a Formula using Global Variables PowerApp created from Dataverse - Stack Overflow

admin2025-05-01  0

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

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)))

Enter a new customer to generate a new customer number.

Assigning the customer number 1544 for every newly created customer.

I have not altered the formula nor the global variable.

转载请注明原文地址:http://anycun.com/QandA/1746096176a91610.html