Welcome Guest! Log in
Stambia versions 2.x, 3.x, S17, S18, S19 and S20 are reaching End of Support January, 15th, 2024. Please consider upgrading to the supported Semarchy xDI versions. See Global Policy Support and the Semarchy Documentation.

The Stambia User Community is moving to Semarchy! All the applicable resources have already been moved or are currently being moved to their new location. Read more…


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.

 

Articles

Suggest a new Article!