Need guidance to write formulas based upon a choice (drop down) selection - InfoPath Dev
in

InfoPath Dev

Need guidance to write formulas based upon a choice (drop down) selection

Last post 02-14-2012 11:06 AM by TxSteve. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 02-09-2012 10:28 AM

    Need guidance to write formulas based upon a choice (drop down) selection

    I have a drop down box (Choice B) with filtering applied to populate Calc fields.

    Choice B

    Calc 1 Calc 2 Calc 3 Calc 4 TOTAL

    Windows

     

    50

    100

     

    10,000

    Lynx

    200

    20

     

    14

    571.43

    Unix

       

    20

    15

    70

     Plus there is another existing field on the form called “Quantity”

    What I am trying to do is get the TOTAL column to do the math based upon the user’s choice in the B column. 

    For example, if the user selects “Windows” the expression box will know to multiply Calc 2 and Calc 3 and multiply by the quantity from another field. In this example, let’s say it’s 2.

    If the user selects Lynx, it will know to calculate Calc 1 x Calc 2 divide by Calc 4 x Qty of 2.

    If the user selects Unix it will add Calc 3 + Calc 4 x Qty of 2.

    How should I go about writing this? I’m very new to formulas.

     

  • 02-09-2012 12:58 PM In reply to

    Re: Need guidance to write formulas based upon a choice (drop down) selection

    Update: So I have a working formula to do the math, but I don't know how to edit it to filter the formulas to trigger based upon the user selected choice from the Choice B column.

  • 02-09-2012 01:13 PM In reply to

    Re: Need guidance to write formulas based upon a choice (drop down) selection

    So, it seems to me that it would be best to have the TOTAL field use a default value so you don't have to write a bunch of rules. But your formula varies according to the selection - so that makes a default value tough.

    I'd put the rule on the ChoiceB field, and then I'd put it on the Qty field as well, since it also comes into play (unless it isn't something the user can change?)

    Hilary Stoupa

  • 02-13-2012 07:00 AM In reply to

    Re: Need guidance to write formulas based upon a choice (drop down) selection

    Good morning, apologies for my delayed response... life happens as they say :) 

    You are correct. The total field needs to reflect different calculations based upon the user's selection from the ChoiceB field. They are different formulas. The qty field is not editable (it is a running total from selections made eariler in the form).

    Being new to writing these things, I was wondering if there is a function such as SUM, CONTAINS or similar, that will allow it to see the ChoiceB field.

    Can you please elaborate on what the rule would look like if placed on the ChoiceB field?

  • 02-14-2012 09:09 AM In reply to

    Re: Need guidance to write formulas based upon a choice (drop down) selection

    Anyone?

  • 02-14-2012 09:19 AM In reply to

    Re: Need guidance to write formulas based upon a choice (drop down) selection

    Want to attach your sample form? Under the Options tab?

    Hilary Stoupa

  • 02-14-2012 09:42 AM In reply to

    Re: Need guidance to write formulas based upon a choice (drop down) selection

    You've got mail! Thank you...

  • 02-14-2012 11:06 AM In reply to

    Re: Need guidance to write formulas based upon a choice (drop down) selection

    Thank you Hilary!

    Looks like my solution will be to add a bunch of rules to the drop box field so that when a user selects an option from the drop down box, it will display the calculated result in the total field.

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