cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Salamander94
Level: Powered On

How to stop a formula from running during submission?

So I have a PO app and the issue is with how it names its forms.  The "Title" specifically speaking.  For the datacardvalue of the title I have

If(
   EditForm1.Mode = FormMode.New,
   "LOG-"& 
   Left(First(Split(User().FullName," ")).Result,1) & Left(Last(Split(User().FullName," ")).Result,1) & "-" & 
   If(
      Len(Text(Value(Last(Split(Last(Filter(PO_Final, "LOG-"&Left(First(Split(User().FullName," ")).Result,1) & Left(Last(Split(User().FullName," ")).Result,1) in Title)).Title, "-" )).Result)+1)) = 1, 
      "000"&Value(Last(Split(Last(Filter(PO_Final, "LOG-"&Left(First(Split(User().FullName," ")).Result,1) & Left(Last(Split(User().FullName," ")).Result,1) in Title)).Title, "-" )).Result) + 1, 
      Len(Text(Value(Last(Split( Last(Filter(PO_Final, "LOG-"&Left(First(Split(User().FullName," ")).Result,1) & Left(Last(Split(User().FullName," ")).Result,1) in Title)).Title, "-" )).Result)+1)) = 2, 
      "00"&Value(Last(Split(Last(Filter(PO_Final, "LOG-"&Left(First(Split(User().FullName," ")).Result,1) & Left(Last(Split(User().FullName," ")).Result,1) in Title)).Title, "-" )).Result) + 1, 
      Len(Text(Value(Last(Split( Last(Filter(PO_Final, "LOG-"&Left(First(Split(User().FullName," ")).Result,1) & Left(Last(Split(User().FullName," ")).Result,1) in Title)).Title, "-" )).Result)+1)) = 3, 
     "0"&Value(Last(Split(Last(Filter(PO_Final, "LOG-"&Left(First(Split(User().FullName," ")).Result,1) & Left(Last(Split(User().FullName," ")).Result,1) in Title)).Title, "-" )).Result) + 1, 
      Value(Last(Split(Last(Filter(PO_Final, "LOG-"&Left(First(Split(User().FullName," ")).Result,1) & Left(Last(Split(User().FullName," ")).Result,1) in Title)).Title, "-" )).Result) + 1 
   ),
   Parent.Default
)

Then for the on visislbe of that slide I have

Set(myLog, "LOG-" & Concat(Split(User().FullName, " "), Left(Result,1)))

So it finds what the last entry was and adds one so each PO is unique.  The problem occurs with submission.  I have 9 different forms all submitting at once and they need to keep the same PO name.  However, I'm finding that they are going up in number on the output.  So in my list I'll have "LOG-AS-0001" and "LOG-AS-0002" and etc. for just one submission.  Where as they all should just say "LOG-AS-0001".  The next time they open the app it should be "LOG-AS-0002".

Capture.PNGI hope this made some sense.  Thanks guys.

5 REPLIES 5
shailendra74
Level 8

Re: How to stop a formula from running during submission?

Hi @Salamander94 

 

To get the PO name you can use the below code:

 

UpdateContext({finalvalue: Concatenate("LOG-xx-", Text(Value(TextInput3.Text), "0000"))}) 

 

four zeros to get 4 digit

Instead of TextInput3, you can get the last number from PO_Final list

 

Once you save your PO through POInfo screen using FormMode.New, the rest screen should be udpating the data to keep the PO name generated.

 

 

Thanks.

Salamander94
Level: Powered On

Re: How to stop a formula from running during submission?

I don't follow.  With this code: 

UpdateContext({finalvalue: Concatenate("LOG-xx-", Text(Value(TextInput3.Text), "0000"))}) 

do I replace the "OnVisible" property or the default property of my "datacardvalue1" box?  Or neither?


shailendra74
Level 8

Re: How to stop a formula from running during submission?

Hi @Salamander94 

 

You can set the default property of your text input.

 

Concatenate("LOG-xx-", Text(Value(MaxNumberFromList + 1), "0000"))

 

Thanks. 

Salamander94
Level: Powered On

Re: How to stop a formula from running during submission?

It errors out for me saying there is a problem with the value.

shailendra74
Level 8

Re: How to stop a formula from running during submission?

Hi @Salamander94 

 

can you share the screen shot.

 

Thanks.

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Next Wednesday, September 18th at 8am PDT

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 213 members 3,113 guests
Please welcome our newest community members: