Help writing a formula - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Help writing a formula

Last post 12-05-2016 07:46 AM by Hilary Stoupa. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 12-01-2016 11:56 AM

    Help writing a formula

    I'm newer than new when it comes to InfoPath and formulas. I've been 'selected' to update an existing form because I happen to show interest...not talent. I need to do the following: If [Textbox1] 0, Sum (-[Textbox2]-[Textbox3]-[Textbox4]+[Textbox5]+[Textbox6]+[Textbox7] Any help would be much appreciated. I don't really know what to search for!
  • 12-01-2016 12:38 PM In reply to

    You should add a new field to your form for the value of this calculation if you don't already have one. Click on Textbox1 and select Manage Rules from the ribbon. Add a new Action rule. Add a condition to check if Textbox1 is equal to 0, and if it is, you can set your new field to the value of the calculation you need - it may be (-1*Texbox2) + (-1*Textbox3) + etc.... You get the idea. I'm not sure what point you are stuck on, so if this is too basic, let me know. I'm attaching a simple sample. Save the linked file locally. Right click the local copy and select Design. From there you can preview, look at the rules, etc. Testing with a sample is less scary than changing your existing form. :)
    Hilary Stoupa

  • 12-04-2016 10:06 AM In reply to

    Thanks Hilary. I didn't even think of a rule. I've tried to modify yours to act like I need mine to. It looks like I need to have the fields I need to add or subtract entered in the control before I enter text in the control with the action. The flow of the form would be to enter in the '2016 (Deficit) / Surplus' number and then enter in the amounts (i.e. Text2, Text3, Text4) to be added or subtracted from that number. It only works if the '2016 (Deficit) / Surplus' control (Text1) amount is entered after the Text2, Text3, Text4 amounts. Weird.
  • 12-05-2016 04:49 AM In reply to

     In that case you might take a different approach and use a button control to trigger the calculation / recalculation when the form is used. That way your user could fill in the '2016 (Deficit / Surplus' control filled in first and then the Text2, Text3, Text4, etc. controls next - the logical flow.  Simply enter a text instruction at the appropriate location in the template telling the user to click the "Calculate" button after updating the Text2, Text3, Text4, etc. controls.  By setting up the calculation rules on the button control, you can make it seem logical to the user.

     Just a thought. 

  • 12-05-2016 07:46 AM In reply to

    I like Michael's suggestion. Basically - rules run when the field with the rule is changed. So, you have a variety of options here. You could put the same rule on all of the fields involved. You could add a button, like Michael suggested. You could use a calculated value, and just hide that value if the first field is = 0. Lots of options! :)
    Hilary Stoupa

Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.