cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rsparks
Helper V
Helper V

Using an If statement to either SubmitForm or trigger a popup

The formula on the form submit button is this:

If(TextInput2.Text = Gallery1.Selected.Quantity, (SubmitForm(Form1); Navigate('Asset Register', None)), UpdateContext({showPopup:true}))

The purpose of the form is to transfer X amount of an item to another location within an asset register. TextInput2 is a field for the user to enter the QTY of an item, and Gallery1.Selected.Quantity is what I believe is the QTY of the item that is currently at the original location. The user selects an item from a gallery, and that opens up an EditForm containing all the item and location data. The user then selects a location from a dropdown and enters a QTY to transfer. 

 

What I want the OnSelect function to do is if the QTY entered by the user equals the QTY of the item at the original location, submit the form and transfer all stock. If the QTYs are different, trigger a pop up which allows the user to enter some extra details. 

 

Both the = and ; symbols seem to be causing issues within the formula. The = error says the values being compared aren't the same type. The ; error says "the formula contains ParenClose where Semicolon is expected.

1 ACCEPTED SOLUTION

Accepted Solutions
ganeshsanap
Super User
Super User

@rsparks Try using below formula: 

 

If(Value(TextInput2.Text) = Gallery1.Selected.Quantity, SubmitForm(Form1); Navigate('Asset Register', None), UpdateContext({showPopup: true}))

 

Check this reference for more information: Do 2 functions inside IF statement when it's true 

Also, check this in case there is any issue with language: Multiple statements in IF-TRUE branch 


Please click Accept as solution if my post helped you solve your issue. This will help others find the correct solution easily. It also closes the item. If the content was useful in other ways, please consider giving it 👍

 

View solution in original post

2 REPLIES 2
ganeshsanap
Super User
Super User

@rsparks Try using below formula: 

 

If(Value(TextInput2.Text) = Gallery1.Selected.Quantity, SubmitForm(Form1); Navigate('Asset Register', None), UpdateContext({showPopup: true}))

 

Check this reference for more information: Do 2 functions inside IF statement when it's true 

Also, check this in case there is any issue with language: Multiple statements in IF-TRUE branch 


Please click Accept as solution if my post helped you solve your issue. This will help others find the correct solution easily. It also closes the item. If the content was useful in other ways, please consider giving it 👍

 

View solution in original post

WarrenBelz
Super User III
Super User III

Hi @rsparks ,

Try

If(
   Value(TextInput2.Text) = Gallery1.Selected.Quantity, 
   SubmitForm(Form1); 
   Navigate('Asset Register', None), 
   UpdateContext({showPopup:true})
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Top Kudoed Authors
Users online (37,582)