Show TOC

Example documentationScripting for Next Step Selection Locate this document in the navigation structure

 

This topic shows some examples of routings defined with scripting, with a description of their behaviors. The examples covered are the following:

  • Simple Test/Debug Loop

  • Failure-Dependent Routing

  • Using Custom Data Fields

Simple Test/Debug Loop

The following figure depicts a simple routing that starts with a TEST operation followed by either the SHIP or DEBUG step:

This graphic is explained in the accompanying text.

Note that the DEBUG step always returns to TEST for a retest.

The following table describes the script logic associated with the TEST step:

From/To Steps

Script

TEST to SHIP (No Failure)

if (NC_CODE==null) exit(true);

TEST to DEBUG (Failure)

if (NC_CODE!=null) exit(true);

The other next steps have no scripts associated with them. Two possible scenarios with this routing are the following:

  • The SFC number passes the TEST and proceeds to SHIP.

  • The SFC number fails the TEST and is sent to DEBUG. The SFC number is repaired at DEBUG by adding a repair NC code. The SFC number is then sent back to TEST. It passes the TEST and is sent to SHIP.

Failure-Dependent Routing

The following figure depicts a routing that sends the failing SFC number to two different locations, depending on the NC_CODE:

This graphic is explained in the accompanying text.

Note that the same thing can be done with the Failure ID associated with the NC_CODE.

The following table describes the script logic associated with the TEST next step:

From/To Steps

Script

TEST to SHIP (No Failure)

if (NC_CODE==null) exit(true);

TEST to DEBUG (Failure)

if (NC_CODE==null) exit(false);

if (NC_CODE!="MISSING_COMP" )

exit(true);

else

exit(false);

TEST to ASSEMBLE (Assembly Failure)

if (NC_CODE==null) exit(false);

if (NC_CODE=="MISSING_COMP")

exit(true);

else

exit(true);

The other next steps have no scripts associated with them. The possible scenarios with this routing are the following:

  1. The SFC number passes the TEST and proceeds to SHIP.

  2. The SFC number fails the TEST with the MISSING_COMP NC Code and is sent to ASSEMBLE. The assembly problem is fixed on the SFC number and at ASSEMBLE. The SFC number is then sent back to TEST. It passes the TEST and is sent to SHIP.

  3. The SFC number fails the TEST and is sent to DEBUG. The SFC number is repaired at DEBUG by adding a repair NC code. The SFC number is then sent back to TEST. It passes the TEST and is sent to SHIP.

Using Custom Data Fields

This routing uses the custom field associated with the SFC number's material to determine where to send the SFC number when it fails.

This graphic is explained in the accompanying text.

Failure-Dependent Routing Example

The script logic associated with the TEST next step is shown below:

From/To Steps

Script

TEST to SHIP (No Failure)

if (NC_CODE==null) exit(true);

TEST to DEBUG (Failure)

if (NC_CODE==null) exit(false);

// Get the custom property COST

cost=getCustomItemProperty("COST");

// Default the cost to $100

if (cost==null) cost =100;

// If the item is worth less than $500, go to DEBUG

if (cost<500)

exit(true);

else

exit (false);

TEST to MRB (High Value Failure)

if (NC_CODE==null) exit(false);

// Get the custom property COST

cost=getCustomItemProperty("COST");

// Default the cost to $100

if (cost==null) cost =100;

// If the item is worth more than $500, go to Material Review Board (MRB)

if (cost>=500)

exit(true);

else

exit (false);

The two lengthier scripts for the failure cases illustrate how to retrieve data for objects in the system, including custom data fields.

The script for TEST to MRB is described below:

  1. If there is no failure, then the SFC number should not follow the TEST to MRB path:

    if (NC_CODE==null) exit(false);

  2. This statement gets the custom COST property for the material using the convenience method getCustomItemProperty():

    cost=getCustomItemProperty("COST");

  3. The next statement sets a default value for the material’s cost if COST is not defined:

    if (cost==null) cost =100;

  4. The last statement includes the logic to decide whether to send the SFC number to MRB:

    if (cost>=500) exit(true); else exit (false);

The size of the script is not limited, but longer scripts run slower.