Workflow Functions

Use the functions below to control the workflow state from APL or to retrieve values from the workflow table.

The following functions for Workflow described here are:

abort

Stops the workflow, and logs a user-defined message to the System Log.

void abort ( string  message )
ParameterDescription

message

A message (of type error), which is sent to the System Log when the workflow is aborted

Returns

Nothing

Note!

The only APL code to be executed after an abort call is the deinitialize function block.

getSecret

Retrieves  a secret from a Secrets Profile of any type. If the storage type is remote, the boolean "useCached" can be used to tell the command to check the local cache before trying the remote storage.


string getSecret(string profileName, 
  string alias, 
  boolean useCache) // Optional


ParameterDescription
profileName

The name of the Secrets Profile to use

aliasThe alias for the secret to use (the alias needs to be present in the profile)
useCacheWhether or not to use the local cache

Note

If the cache is used and the secret retrieved doesn't work for some reason, to get a new one you need to call the function again with useCache set to false.

Also note that if the workflow in question is configured to be stand-alone, this function can only be used in initialize.

cancelBatch

Emits a Cancel Batch that aborts the processing of the current batch and possibly continues with the next file (depending on the Workflow Configuration).

void cancelBatch
 ( string  message ,
 drudr  errorUDR  ) //Optional
ParameterDescription

message

A message (of type error), which is logged to the System Log when the batch is canceled

errorUDR

It is possible to send an error UDR containing any useful information to the ECS where the batch is sent (if configured to do so). Note that an error UDR may be defined from the Workflow Properties dialog as well. In this case, the APL code overrules the window configuration.

This parameter is optional.

Returns

Nothing

dynamicFieldGet

Retrieves the stated dynamic field from the workflow table. The returned value can either be a boolean, an integer, or a string. The fields are configured in the Dynamic Fields tab in the Workflow Properties. See Dynamic Fields Tab in the Desktop User's Guide for further information.

Note!

The APL code will not validate unless the dynamic field(s) has been configured in Workflow Properties.

boolean/int/string dynamicFieldGet 
    ( string category, 
      string name )
ParameterDescription
category The dynamic field's category
nameThe name of the dynamic field
ReturnsThe value of the selected dynamic field

hintEndBatch

Large input files can be split into smaller output files using hintEndBatch. The function will send an End Batch message to the other agents in the workflow, possibly causing a split of the current batch being processed. How each agent acts upon such a request can be found out in the respective user's guide; in the Transaction Behavior section. If the workflow does not contain any agent capable of acting upon the request, the workflow will abort.

Note!

The hintEndBatch() function is only supported for workflows containing one of the following:

  • Database Collection agent

  • Disk Collection agent

  • FTP Collection agent

void hintEndBatch()
ParameterDescription

Returns

Nothing

Note!

A split batch cannot be sent to ECS. Calling cancelBatch after hintEndBatch, will result in workflow abort. However, the original batch can be sent to ECS to make sure to evaluate if the batch will be canceled before it is split.

sleep

Puts the current thread to sleep a given number of milliseconds before resuming execution. This is mostly used for simulation, for instance, traffic shaping or limiting the number of calls to an external system.

void sleep
 ( long  milliseconds  )
ParameterDescription

milliseconds

The number of milliseconds the current thread will sleep before resuming execution.

Returns

Nothing

wfStop

Stops a running workflow.  wfStop produces a single stop signal and does not wait for the workflow to stop. If it succeeds in stopping the workflow, the stop is registered in the System Log.

string wfStop ( string  wfName , boolean  immediate  )
ParameterDescription

wfName

The name of the workflow that should be stopped.

Note!

This command can be used from within the same workflow that should be stopped.

immediate

True: Stops currently handled batch.

False: Runs through currently handled batch and then stops.

Note: In a real-time workflow this immediate flag has no significance.

Returns

A string. If the command is successful the value is null. Otherwise, a text message is returned.