What is best: rules or a calculated value field to achieve a simple goal? - InfoPath Dev
in

InfoPath Dev

What is best: rules or a calculated value field to achieve a simple goal?

Last post 07-24-2014 07:43 AM by AmsterdamSchool. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 07-23-2014 04:59 AM

    What is best: rules or a calculated value field to achieve a simple goal?

    Imagine a simplified form with 3 text fields A, B, and C, and a boolean field D. D functions as a status flag for a work flow. If A or B or C has any input (= not empty) D should be set to true. As far as I can tell there are two way to do this: rules and calculated values. I could create an action rule ‘If A not empty Or B not empty Or C not empty then set D to True’. However, to which field do I attach this rule? If I attach it to field A and leave that field empty and add content to field B, will this rule be triggered? Should I add the same rule to all three fields A,B and C? I’ll probably also need a separate rule to set D to false in case the content of a field is deleted. Maybe making D a calculated value field is better, but I find If then statements in Xpath not very straightforward. What would you suggest as the best approach? Thank you.
  • 07-23-2014 08:32 AM In reply to

    Re: What is best: rules or a calculated value field to achieve a simple goal?

     Create another field i.e. Result. This will be hidden from the view.

    Its default value is A ! = "" or B != "" or C !="" (a is blank, b is blank, c is blank). Make sure the option Refresh value when formula is recalculated is ticked.

    On the Result field you can have 2 rules.

    a. Set field D to true

    Condition Result = true, set field D to true. Tick the box Dont run condition if met.

    b. reset field D

    Action set field d to blank.

  • 07-24-2014 07:00 AM In reply to

    Re: What is best: rules or a calculated value field to achieve a simple goal?

    Thank you. I'm not sure I quite get it, though.

    How can A ! = "" or B != "" or C !="" be a value? This to me is a condition and not a value, and even then, what would be the syntax if I actually wanted to enter such a condition/value? If you could clarify this, that would be great. Thanks for your time.

  • 07-24-2014 07:22 AM In reply to

    Re: What is best: rules or a calculated value field to achieve a simple goal?

     In my head I put the attached together.

     N.B. I'm away for 2 weeks, so maybe somebody else can pick this up. 

  • 07-24-2014 07:43 AM In reply to

    Re: What is best: rules or a calculated value field to achieve a simple goal?

     ah! I get it. I had to take it much more literally than I did. The  A ! = "" or B != "" or C !="" is actually entered and results in a true or false (without IF-Then etc), which is in turn the actual value. I would have thought this required the Result field to be a Boolean but apparently it works as well with it being a string field. Learning all the time :-)

    Thank you

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