Welcome Guest! Log in
Due to some maintenance operations, stambia.org will be switched to read-only mode during the 13th November. It will be possible to read and download, but impossible to post on the forums or create new accounts. For any question please contact the support team.


Sometimes a process is based on a data file which can be missing (the partner did not send it, or there was no data to receive). This articles shows how to condition the execution of the process to the existence of a data file.

 

What we want to do

We have a data file named "T1595" which is defined in a Metadata file.

We have a process which executes actions on this file.

But some days the file is missing, and we don't want the process to be executed.

 

The process

Here is an overview of the process:

process

 

The first step is a "FileWait" action from the Palette. We drag'n'dropped the file's metadata on it, so that the action is automatically set to wait for this file. We set the parameter "WAIT_FILE_TIMEOUT" to 0 (which is 0 millisecond), but we could have chosen 60000 if we wanted to wait for the missing file during 1 minute.

When the action has found the file or the timout delay has passed, the action stops and its variable "FILE_NB" is set to the number of files which were detected. In our case, we expect FILE_NB=1, or 0 if the file is missing.

 

Conditionning the next steps of the process is done by adding an Execution Condition on the links (notice that they appear as dotted lines which means they is an execution condition on the link).

For more information on Execution Conditions, please read the Designer's documentation:
Stambia > Designer User's Guide > Working with Processes > Advanced Process Development > Scripting > Using Scripts in Conditions

Here are the Execution conditions (they are Javascript expressions which return a boolean value):

  • For the left link: ${FileWait/FILE_NB}$ == 0
  • For the right link: ${FileWait/FILE_NB}$ == 1

The expression ${FileWait/FILE_NB}$ evaluates to the FileWait action's variable FILE_NB.

ExecutionCondition

 

The final step is the "ProcessFile" action, placed right after the "File found" empty action. It will be executed only when FileWait/FILE_NB == 1.

We can see in the image above that when the file is missing, the right part of the process is not executed.

You can also imagine adding actions after the "File is missing" empty action, like sending an email, logging information somewhere, etc.

 

You have no rights to post comments

Articles

Suggest a new Article!