problem using multiple rules to set a fields value. - InfoPath Dev
in

InfoPath Dev

problem using multiple rules to set a fields value.

Last post 05-23-2013 06:38 AM by seanbjack. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 05-22-2013 09:08 AM

    problem using multiple rules to set a fields value.

    I'm having trouble with a set of rules I have setup in infopath 2010 form for a sharepoint list (list is in sharepoint 2010)

    I have a field (targetfield) that I want to set the value to either 1, 2 or 3 based on a number of combinations of values in other fields

    I have 3 boolean fields (year1, year2 and year3) that check when a running total becomes greater than zero over time. These fields are defaulted to false initially using a form load rule if no data has been entered in the form. If the running total becomes great than zero in the second year then "year2" and "year3" fields return a value of true and "year1" remains false etc. I now want to run a calculation that populates "targetfield" based on the year that total becomes true (calculation will differ depending on which year it first becomes true).

    I have setup 3 rules on "targetfield"

    rule1: if yr1 = true then set value of targetfield to 1, rule2: if yr2=true AND yr1=false then set value of targetfield to 2, rule3: if yr3=true AND yr2=false then set value of targetfield  to 3

    for some reason this will not set the value based on these conditions. I have replicated these exact same rule conditions to change the formatting of the field and these work as expected and without issue.

    Any ideas on what I may be missing?

     Thanks, Sean

     

    Filed under:
  • 05-22-2013 11:56 AM In reply to

    Re: problem using multiple rules to set a fields value.

    Hi-

    Would you be able to attach your form (via the Options tab when responding)?

    This sounds pretty straightforward, so there may be an error in your form logic. Taking a look at the form in design mode is the easiest way to figure that out.

    Thanks!

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 05-23-2013 12:55 AM In reply to

    Re: problem using multiple rules to set a fields value.

    Hi-

    I have attached the form. The rules are attached to "field1"

    Thanks for your help

     

  • 05-23-2013 06:05 AM In reply to

    Re: problem using multiple rules to set a fields value.

    Since you want to set the value of field1, you cannot have the rules on this same field. The rules will never fire.

    When the values of /dfs:myFields/dfs:dataFields/my:SharePointListItem_RW/my:_x0079_r1 /dfs:myFields/dfs:dataFields/my:SharePointListItem_RW/my:_x0079_r2 and /dfs:myFields/dfs:dataFields/my:SharePointListItem_RW/my:_x0079_r3 change, then you can have rules fire, and based on the various conditions, you can have an action that set's the value of field.

    So, in summary, your rules need to be on the BenefitsRealized1, 2 and 3 fields instead.

    Hope this helps!

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 05-23-2013 06:38 AM In reply to

    Re: problem using multiple rules to set a fields value.

    Many thanks - that works!

    I had initially set them up that way however i didn't appreciate that the conditions needed to be repeated under each control and my logic was a bit out. I've got it working now

    Thanks again for your help

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