If the following 'variables' are defined: (These 'variables' can be any information that is recorded on the Part Record)

  • A = 12
  • B = 15
  • C = 2
  • D = 18.123
  • E = Hello
  • F = World
  • G = 3/31/2002 12:00:00 AM
  • H = 5/2/2002 12:00:00 AM
  • [NOW] = -- Current Date --  (01-06-2011)

Note: Formulas are not case sensitive

You can use these 'variables' in formulas, like as shown in the following examples:

  • 1+2 -> 3
  • [E] + ' ' + [F] + ' !' -> Hello World !
  • IIF([A]>[D],[E],[F]) -> World
  • Format('dd-MM-yy', Now()) -> 17-02-09
  • Format('f',[D]) -> 18.123
  • Format('f1',[D]) -> 18.1
  • Format('f2',[D]) -> 18.12
  • Format('f4',[D) -> 18.1230
  • Convert('tostring',[E]) -> 'Hello'
  • format('MM-dd-yyyy', convert('todatetime',[NOW]+3*)) -> 01-09-2011

Math

  • IIF([A] = [A], True, False)  -> True
  • IIF([A] != [A], True, False)  -> False
  • [A] = [A] -> True
  • [A] != [A] -> False
  • [B] - [A] -> 3
  • [B] - [A] -> 27
  • [A] * [C] -> 24
  • [A] / [C] -> 6
  • Example for a AND Type operation
  • IIF([A] = [A], IIF([B] = [B], True, False), False) -> True
  • IIF([A] = [A], IIF([B] = [C], True, False), False) -> False
  • Example for a OR Type operation
  • IIF([A] = [A], True,IIF([B] = [B], True, False)) -> True
  • IIF([A] = [A], True,IIF([B] = [C], True, False)) -> True
  • IIF([A] = [C], True,IIF([B] = [B], True, False)) -> True
  • IIF([A] = [C], True,IIF([B] = [C], True, False)) -> False

Functions

You can use the following function in the formulas:

  • sin(), cos(), pi()
  • sqrt()
  • abs()
  • iff()
  • max(), min(), 
  • ln()
    • Natural logarithm, where the base is 'e'.
  • log()
    • Logarithm where the base can be selected, example log(2,10) where the logarithm of 2 is calculated with base 10.
  • med()
    • Calculated the median of the provided variables, example syntax med([VARA],[VARB],[VARC],[VARD],...)
  • stdev()
    • sd
    • where Σ = Sum of
      X = Individual values
      M = Mean values
      N = Sample size (Number of values)
  • stdevp()
    • popsd
    • where Σ = Sum of
      X = Individual values
      M = Mean values
      N = Sample size (Number of values)
  • CONVERT('see below', value)
    • tobool
    • toint
    • todouble
    • todatetime
    • tostring
  • left()
    • Needs a string and a number: left([T],[N]).
    • For example left('Hello',2) will give back the string 'He'.
    • Variables can be used as well, so left([E],[C]), using the configuration above, will give back 'He' as well.
  • right()
    • Needs a string and a number: right([T],[N]).
    • For example right('Hello',2) will give back the string 'lo'.
    • Variables can be used as well, so right([E],[C]), using the configuration above, will give back 'lo' as well.
    • For example to do a translation of the most right number in a string to text, the following example can be used
      • IIF(right([T],[N])='6','Six','Not Six'), where T is the text, and N should be the number 1.
  • mid()
    • Needs a string followed by two numbers: mid([T],[P],[N]). Where the first number is the position, and the second number is the length.
    • For example mid('Hello',2,3) will give back the string 'llo'.
    • Variables can be used as well, so mid([E],[C],[C]+1) will give back the string 'llo' as well.
  • rand()
    • Create random numbers, rand(1,8) for example will create random numbers starting at 1, and ending at 8.
     

Part Functions

There are a few functions that can be used to perform calculations where all Part Records are taken in consideration. The result will be written to all parts on the traveler. For all those functions a variable needs to be defined that will be used for the calculations. Those functions are:

  • PRSUM([VAR]) - This can be used to summarize the [VAR] NV that is available for all parts on the traveler.
  • PRMAX([VAR]) - Find the highest value of the [VAR] NV on the traveler for all parts.
  • PRMIN([VAR]) - Find the lowest value of the [VAR] NV on the traveler for all parts.
  • PRCOUNT([VAR]) - Count the number of parts on the traveler that have the [VAR] NV
  • PRAVG([VAR]) - Calculate the average value of the [VAR] NV on the traveler for all parts
  • PRMED([VAR]) - Calculate the median value of the [VAR] NV on the traveler for all parts

Built-In millisecond conversions

millisecondconversion

 

Nested IIF Statements

This example uses three variables to display a text return on which channels fail.  

Calc NV Config

It is important to remember that all variables being returned, such as [A], [B], and [C] are strings.  So we have to use the Convert to change them to doubles.  Then we can compare it to a number, in this case it is 18.5.
 
IIF(Convert('todouble',[A])>18.5,
 IIF(Convert('todouble',[B])>18.5,
  IIF(Convert('todouble',[C])>18.5, "All Channels Pass", "CH 11 Fails"),
  IIF(Convert('todouble',[C])>18.5, "CH 6 Fails", "CH 6 and CH 11 Fails")
 ),
 IIF(Convert('todouble',[B])>18.5,
  IIF(Convert('todouble',[C])>18.5, "CH 1 Fails", "CH 1 and CH 11 Fails"),
  IIF(Convert('todouble',[C])>18.5, "CH 1 and CH 6 Fails", "All Channels Fail")
 )
)

 

Calc NV Return

 

Convert Date Month to a Letter

This Calc formula will convert a Month Digit of 01, 02, 03, ... 12 into an Alpha Character.

Calc String Formula

IIF(Format('MM', Now())="01","A",IIF(Format('MM', Now())="02","B",IIF(Format('MM', Now())="03","C",IIF(Format('MM', Now())="04","D",IIF(Format('MM', Now())="05","E",IIF(Format('MM', Now())="06","F",IIF(Format('MM', Now())="07","G",IIF(Format('MM', Now())="08","H",IIF(Format('MM', Now())="09","I",IIF(Format('MM', Now())="10","J",IIF(Format('MM', Now())="11","K",IIF(Format('MM', Now())="12","L","X"))))))))))))

 

Useful Links

Click one of the following links to learn more: