AnsweredAssumed Answered

Clear Instructions on using operators in expressions.

Question asked by kbbs on Jul 26, 2013
Latest reply on Aug 23, 2013 by kbbs

Title

Clear Instructions on using operators in expressions.

Post

     Hi -  I am new to FMpro v 12.0v4, and have had moderate success in writing scripts (sometimes they work).  I think I understand what each of the operators are for, and I get most of the functions, but I'm having difficulty writing an expression.  I'm not putting the functions, field parameters, operators, and constants in the correct order when writing calculations within calculations.  Can someone suggest a good reference for this that clearly states when to use opening and closing parentheses rather than ";" as well as "and" rather than "&", etc?  If some of you who are knowledgeable are up for a minor challenge, I've written in my problem below. THANKS!! 

     I'm working on a calculation for an autofill.   My calculation involves three fields.  Two of those Fields will contain raw data entered by a user, and the third field will be auto fill.  

     The calculation for the auto fill needs to say:

     ______________________________

     If fields 1 & 2 are empty, then value = " ";

     If field 1 is ≤X and field 2 is ≤X, then value = "X";

     If field 1 is within this range and field 2 is within this range, then value ="X"; //the range statement would continue until ≥ can be used//)

     If field 1 is ≥X and field 2 is ≥X, then value = "X"

     ______________________________

     By using the specify calculation in the manage database function, here is what I've started coding just to get through the first two lines:

     Because I've selected Field3, FM starts me with Field3=, and then I type:

          If (IsEmpty (Field1 & Field2);" ";
          (If (Field1  ≤13 and Field2 ≤6;  Field3 = 40)))

     ______________________________

     This returns a value of "0" when Field 1 contains a value ≤13, and Field 2 contains a value ≤6, BUT I want it to give me a value of 40!  ARG!!  lol 

     Help?

Outcomes