You can have a one or a multitude of conditions that can be required for the Trigger to fire, but it only takes one of those conditions to be false, and it will not fire.  When the Trigger fires, it initiates an Action.

This article will cover tips on creating triggers for some common items.

Syntax - Common Use In 'Done String' Formula

IIF statement explanation 1

In order to help best explain the IIF statement, we will give two different expanations. 

Standard

IIF(condition1, True, False)

OR

IIF(condition1, True, (condition2, True, False))

AND

IIF(condition1, (condition2, True, False), False)

IIF statement explanation 2

Here is the second way of examining the IIF statement.

  • IIF(Condition, Expression1, Expression2)

If the Condition evaluates to TRUE Expression1 will be evaluated.

If the Condition evaluates to FALSE Expression2 will be evaluated.

So the following will have the same result:

  •  A: Condition (1>2, 1=2)
  •  B: IIF(Condition, TRUE, FALSE)

 For A the Condition will evaluate to TRUE or FALSE, which will be the end result of this evaluation.

 For B: if Condition will evaluate to TRUE the First Expression of the IIF statement will be evaluated resulting in TRUE. If the Condition will evaluate to FALSE the second part of the IIF statement will be evaluated, resulting in FALSE

True and False Return Values

The following will all evaluate to TRUE.  The same applies to FALSE return values.

  • TRUE
  • “TRUE”
  • ‘TRUE’
  • “TRUE’
  • TrUe
  • true
  • ‘truE”

Standard Examples

  • 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

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'

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

 

Examples for a AND Type operation

If you have 2 conditions: C1: Condition 1 & C2: Condition 2 and you want to perform an AND operation on the 2 Conditions the following construct will work:

  • IIF(C1, C2, FALSE)

If C1 evaluates as TRUE, C2 will be evaluated and if C2 evaluated to TRUE, the total IIF statement will evaluate as TRUE.  If either C1 or C2 will evaluate to FALSE, the total IIF statement will evaluate as FALSE

  • IIF(C1, IIF(C2, C3, FALSE), FALSE)

This expression has the same result as C1 AND C2 AND C3 

We can further extend this expression for another condition C4 as illustrated below:

  • IIF(C1, IIF(C2, IIF(C3, C4, FALSE), FALSE), FALSE)

If we add another condition C5 the expression will be as illustrated below:

  • IIF(C1, IIF(C2, IIF(C3, IIF(C4, C5, FALSE), FALSE), FALSE), FALSE)

Example for a OR Type operation

If you have 2 conditions: C1: Condition 1 & C2: Condition 2 and you want to perform an OR operation on the 2 Conditions the following construct will work:

  • IIF(C1, TRUE, C2)

If C1 evaluates as FALSE, C2 will be evaluated and if C2 evaluated to FALSE, the total IIF statement will evaluate as FALSE.

If either C1 or C2 will evaluate to TRUE, the total IIF statement will evaluate as TRUE

 

  • IIF(C1, TRUE, IIF(C2, C3, TRUE))

This expression has the same result as C1 OR C2 OR C3

 

 

Equals and Not Equals

Equals:

  •  1=2 Evaluates to FALSE
  • 1=1 Evaluates to TRUE
  •  1==1 is wrong and will result in error: Stack is empty on Eq

 Not Equals:

  •  1!=1 Evaluates to FALSE
  • 1!=2 Evaluates to TRUE
  •  “A” = “B” Evaluates to FALSE
  • “A” = “A” Evaluates to TRUE

Using Variables

The String Attribute option to enter Variables CANNOT be used to enter values for variables.

Variables can be added

When you use Variables in the String Formula enclose them with square brackets: [A]

Any stored Name-Value on the Part Record can be used as a variable:

[A] < 1

[A] = Step:SD10-000008 Rev:A : Numeric Test Data (9.4)

 Evaluates to FALSE

[A] > 1

[A] = Step:SD10-000008 Rev:A : Numeric Test Data (9.4)

 Evaluates to TRUE

 Variables are case sensitive:

[a] > 1

[A] = Step:SD10-000008 Rev:A : Numeric Test Data (9.4)

 Will give the error message: Bad variable name !

 When variables are added any lower case characters in the Variable name will be converted to upper case:

 aa -> AA

 This variable can only be addressed by using [AA] in the Formula.

Built-In

  • <%day%>  or <%days%>  -> returns the Millisecond value for one day of time.
  • <week%> or <%weeks%> -> returns the Millisecond value for one week of time.
  • <%month%> or <%months%> -> returns the Millisecond value for 30 Days of time.
  • <%hour%> or <%hours%> -> returns the Millisecond value for one hour of time.
  • <%min%> or <%minute%> or <%minutes%> -> returns the Millisecond value for one minute of time.
  • <%sec%> or <%second%> or <%seconds%> -> returns the Millisecond value for one second of time.
  • <%year%>  or  <%years%> -> returns the Millisecond value for 365 Days of time.

 

Real World Examples

Purpose

Verify two items in order to fire the trigger. 

1.Checks if the 'Current Part Step' is equal to 'SD10-000009 Rev:A (Inspection - Lot Processor)'

2. Checks if name value 'Rework Required' is true.

Done String

IIF(([CURSTEP]!=[STEP]),[TESTFAIL]='True',False)

Variables

[TESTFAIL] = Step:SD10-000009 Rev:A : Rework Required
[STEP] = SD10-000009 Rev:A (Inspection - Lot Processor)
[CURSTEP] = -- Current Part Step --

 

Purpose

Verify a step has been signed out of a step.

1.Checks if the 'Current Part Step' is equal to 'SD10-000028 Rev:A (Strip PR in ACT(strip))'

Done String

[CURSTEP]!=[STEP]

Variables

[CURSTEP] = -- Current Part Step --
[STEP] = SD10-000028 Rev:A (Strip PR in ACT(strip))

 

Purpose

Evaluate if 48hours has elapsed since the Event was created.

1.calculates '-- Current Date --' minus '-- Event Created Date --'

2. calculates if step 1 is greater than 48 hours.

Done String

[CURDATE]-[EVDATE] > 48*<%hours%>

Variables

[CURDATE] = -- Current Date --
[EVDATE] = -- Event Created Date --

 

Purpose

Evaluate if 7days has elapsed since the Event was created.

1.calculates '-- Current Date --' minus '-- Event Created Date --'

2. calculates if step 1 is greater than 7 days.

Done String

[CURDATE]-[EVDATE] > 7*<%days%>

Variables

[CURDATE] = -- Current Date --
[EVDATE] = -- Event Created Date --

 

Purpose

Evaluate if a Name Value checkbox is true or false.

1. Calculates if Name Value returns true

 

Done String

[BURNINFAIL]='true'

Variables

[BURNINFAIL] = Rev: () : Fail?

Purpose

Check if Signature NV is Accepted or Rejected.  Also make sure the current step is signed off prior to the Trigger Firing.

Signature NV will return one of the following:

  • Approved
  • Rejected

 

Done String

IIF(([CPS]!=[STEP]),[SIG]='Rejected',False)

Variables

[SIG] = Step:SD12-000000002 Rev:A : SignOff: Sample Test Results
[STEP] = SD12-000000002 Rev:A (Awaiting Sample Test Results)
[CPS] = -- Current Part Step --

 

Purpose

Verify three different checks.

  1. The Time of Event Created + 4 Minutes > Now
  2. The Traveler State must be = 'Cued'
  3. The Current Traveler Step Must be = SD12-28 Rev:A (Step Name)
Done String

IIF([NOW]>[ECD]+4*<%min%>,IIF([STATE]="CUED",IIF([CTS]=[STEP],true,false),false),false)

Variables

[NOW] = -- Current Date -- [Pre-Defined]

[ECD] = -- Event Created Date -- [Pre-Defined]

[STATE] = -- Current Traveler Process State -- [Pre-Defined]

[CTS] = -- Current Traveler Step -- [Pre-Defined]

[STEP] = SD12-28 Rev:A (Step Name)  [Variable SD]