PilotScript Control Functions

The following control functions are available for PilotScript components.

Control Function Name/Prototype Description Example

Assert

None Assert(Boolean test[, String error])
Forces an error condition if test evaluates to False.
Assert(#i == numValues, "Processing incomplete");

The error message includes the line number of the failed assert function (useful for testing purposes).

BlockPipeline

None BlockPipeline()
Returns immediately, without passing out the current data records, and prevents additional data records from passing into the component holding this script.
IF (#numberProcessed >= @maximum) 
 THEN
	BlockPipeline();

END IF;

#numberProcessed ++ ;

Error

None Error(String message)

Throws an error with the given error message, ending the protocol unless a containing component instance specifies some other error handling behavior in its Error tab.

IF (props IS NOT DEFINED OR numvalues(props) == 0) THEN
Error("No properties found in property 'props'");

END IF;
HaltProtocol
None HaltProtocol()

Immediately stops the execution of the expression script and sends a signal so the protocol job is ended and no longer processes any data.

IF (QAResult EQ 'Stop') 
 THEN
	HaltProtocol();

END IF;

Immediately stops the protocol from running any further.

TerminatePipeline

None TerminatePipeline()

Immediately ends the execution of the expression script and sends a signal so downstream nodes in the pipeline are finalized and no longer receive data. The precise behavior is controlled by the mode parameter.

'Fail' or 'None' as an optional second argument to the TerminatePipeline function. A use case for this mode is to shut down an upstream file reader component after a specific condition is met.

Modes

  • DownStream: This is the default behavior if no parameters are used. In this mode the script component and all downstream components are terminated immediately. No finalization step occurs, and no data record is passed out of the script component. Use this in cases where you want upstream components to continue running with the full data record set.
  • UpAndDownStream: This mode includes the behavior of the DownStream mode, but also shuts down upstream components. This ends all activity in the pipelines passing through the script component.
  • Source: In this mode, all upstream source components are terminated, effectively shutting off the source of data for the pipelines flowing through the script component. Note that the current script processing ceases with this call, although the data record is passed to the next component. By default the record is passed out of the Pass port, but this can be modified by using one of the text strings 'Pass', 'Fail' or 'None' as an optional second argument to the TerminatePipeline function. A use case for this mode is to shut down an upstream file reader component after a specific condition is met.
IF (QAResult EQ 'Fatal') 
 THEN
	TerminatePipeline();

END IF;

This component, and all downstream components, are declared done processing data, and do not accept any more work. Other pipelines in the protocol continue to run.

IF (RecType EQ 'END') 
 THEN
	TerminatePipeline('Source', 'Pass');

END IF;

Switches off the upstream reader component when a specific record type is found.