What are Variables

Variables are creatable stores for values you would like to use elsewhere. You can write any text value you like to a variable, and it will be remembered thoughout the period that your message is processed. Variables are not shared between different received messages.

Once you have created variables they can be inserted all over the place. Many activity properties can use the values stored in variables to customize how your workflow runs.

For example, lets say you received an HL7 Message, and wanted to write it to a file. You'd like to name that file using the patients ID from the PID-3 so it's easily machine readable, and you would also like to include the name of the patient (PID-5.1 and PID-5.2) to make it easily human readable.

Create variables in the Transformers of your file writing activity so that you store your inbound values.

Create variables in a transformer

Now navigate back to the file writing activity and add your variables to the 'file to write' in order to create the file name. You can right click to insert the variable, or just type it in using the format $(VariableName).

Use variables to create a file to write to

You can use multiple variables at the same time to build up your file name, and even intermingle this with fixed text to build up your desired file name.

There are also a couple of workflow related variables that are always available; 'CurrentDateTime' and 'ReceivedDate'. You can pretty easily guess what they return, they will certainly come in handy

Variables also come with an added bonus, they also include date an number formatting. Include a : at the end such as ${CurrentDateTime:g} and you'll have the date returned in your windows 'General date/time pattern (short time)' format. See here for the full list of date formatters.

Finally, you have the option to create variables in custom code transformers. These could get data from external datasources, or format your values in any format you like with .net.

More details about variables are available in our Transformers Tutorial.