Greetings!
I'm using InfoPath 2013 on a Windows 7 64-bit OS
I'm getting inconsistent results from a set of conditions that I'm using on a form to evaluate the relationship between three values.
I'm developing a form that will be used in the field for collecting water samples. The samplers will collect a series of three samples, entering each value into three fields on the form. When the third field is filled I need the form to compare Field3 with Field1, and Field3 with Field2, and set the value "Stabilized" in a status field "txtStatus" if the comparisons are all within .1 of each other. If they are not within .1 then a second rule sets "txtStatus" to "Not Stabilized". The evaluation needs to take into account the fact that the each value might be greater than or less than the previous value, but it's the absolute difference that I need to assess.
I have a rule "Is Stable" which includes the following condition bound to Field3. If this conditions evaluates to true it sets the value for txtStatus to "Stabilized":
(../my:Field1 - .) * (1 - 2 * (../my:Field1 - . < 0)) <= 0.1
and
(../my:Field2 - .) * (1 - 2 * (../my:Field2 - . < 0)) <= 0.1
The complimentary rule "Not Stable, also set on Field3, includes the following condition. If this conditions evaluates to true it sets the value for txtStatus to "Not Stabilized":
(../my:Field1 - .) * (1 - 2 * (../my:Field1 - . < 0)) > 0.1
or
(../my:Field2 - .) * (1 - 2 * (../my:Field2 - . < 0)) > 0.1
The "(1 - 2 * (../my:Field1 - . < 0))" part is my understanding (from http://www.infopathdev.com/forums/p/22269/77077.aspx) how to calculate absolute value in InfoPath.
In practice, the results from these rules are inconsistent... sometimes they work and sometimes they don't. Here's an example of (these are pH readings, BTW...):
Field1: 7.0, Field2: 7.1, Field3: 7.0, results in "Stabilized" (correct)
Field1: 7.1, Field2: 7.2, Field3: 7.1, results in "Not Stabilized" (wrong - should be "Stabilized")
Field1: 7.2, Field2: 7.3, Field3: 7.2, results in "Stabilized" (correct)
Any idea where my problem is with the way the conditions are written? Any thoughts on a better way to go about this process?
Many thanks for any input.