rule based on more than one control - InfoPath Dev
in

InfoPath Dev

rule based on more than one control

Last post 04-25-2006 01:29 PM by Greg Collins. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 04-21-2006 05:42 PM

    • zshadi
    • Not Ranked
    • Joined on 04-22-2006
    • USA
    • Posts 2

    rule based on more than one control

    i want to set a calculated value for a field based on the values of two other controls... so i need a series of if/then statements, but it appears that i can set the value of that field only based on one control... is this true? from what i see, the rule applies only if the value of the one control changes... is there a way around this w/o coding??? or my question doesn't even make sense? :-(

    thanks,

    shadi
  • 04-21-2006 09:13 PM In reply to

    Re: rule based on more than one control

    Hi Shadi,

    Welcome to our site. What you want to do is set a "Default" value using A formula on the target field. For example if you have:

    quantity, amount, total fields

    Double-click the total field, then set the "default value" using the formula dialog as the quanitity field * the amount field.
    Shiraz Cupala / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 04-24-2006 09:38 AM In reply to

    Re: rule based on more than one control

    If the values you want to use are text rather than numbers, you would use a formula like: concat(field1, " ", field2, " ", field3) etc...
  • 04-24-2006 10:28 AM In reply to

    • zshadi
    • Not Ranked
    • Joined on 04-22-2006
    • USA
    • Posts 2

    Re: rule based on more than one control

    thank u so much for ur responses... here's an example of what i'm trying to do:

    if field1 is equal to 'Y' and field2 is equal to 'cashback' then the calculated value for field3, 4, 5, 6, 7 will be (fieldx / fieldy) * 100

    if field1 is not equal to 'Y' and field2 is 'whatever' then the calculated value will be something else for the rest of the fields

    i'm trying to set the rule at field 1 for all this... doesn't look like it can work... i tried setting the rule at each of the fields 3, 4, 5, etc, but that did not work either...

    thanx again for any responses...
  • 04-25-2006 01:29 PM In reply to

    Re: rule based on more than one control

    Since your two trigger fields are field1 and field2, you need a duplicate set of rules on both of those fields. A better way would be to write one code function which does all this, and then use the OnAfterChange event on field1 and field2 to call that function.

    But if you are determined to do this via rules, you still can. Its just more work. You will need to make a duplicate ruleset for field1 and field2. That ruleset would have two rules. Each rule would have a condition (as you described above). If the condition succeeds, then the rule actions are applied. Make sure to select the check box at the bottom of the rule actions to stop running the ruleset after the actions have been applied.
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.