Self Service Lab - Starting with Workflows: Variables and Data Flow
The purpose of this document is to provide step by step instructions for building a simple introductory Pliant Workflow.
Introduction to Pliant Variables and Data Flow
Understanding Pliant variables is critical to building effective workflows, as the variables are how we get data into and out of Workflows, and variables pass data between Action Blocks. The variables can be configured to be Input, Output, neither, or both. We will look at how to use these options in the exercises ahead.
The first exercise Building the "Hello World" Workflow builds a simple workflow to show how the input and output variables are used
The next exercise Calling the Hello World Workflow shows how Workflows can become action blocks in other Workflows, and how the input and outputs of a Workflow relate the inputs and outputs of a block
A. Building the "Hello World" Workflow
A1. Navigate to the "WORKFLOWS" tab, click the "+ Create" button, and choose the "Create Folder" option.
A2. Name the folder "Beginning_Flows", optionally add a description, and click the "Create" button
A3. Click on the "Beginning_Flows" folder
A4. Click on the "+ Create" link and choose the "Create Flow" option from the drop down
A5. Name the flow "Hello_World", leave Layout type as Sequence, optionally add a description, and click the "Create" button
A6. You should see the following basic workflow. By default, each Pliant workflow is created with an Output variable called "result", and an Assign block that will set the value of $result to be "Hello, World!"
A7. Click the "+ Add Variable" button, and a new blank variable will appear
A8. Name the new variable "Repeat_Text", give it the default value "Hello World!", and check the "Input" and the “Required” box
A9. Click on the line after the "Value" input blank inside the Assign block, delete the text, and enter an 'r'. A menu of options will pop up. This time choose the option for the "$Repeat_Text" variable.
A10. You have now built a simple workflow that will take the value from the "Repeat_Text" variable and assign it to the "result" variable. As the result variable is flagged as an "Output", it will be returned by the workflow and shown when the workflow is run.
A11. Click the Save button in the top right of the workflow editor
A12. Click the "Run" button
A13. A box should appear below the End block of the Workflow showing the result
A14. In the Start block, check the box to flag the "Repeat_Text" variable as an Output.
A15. Run the Workflow again, you should now see the following output in the box below
Any variable flagged as an output will always be returned by the Workflow.
A16. Uncheck the "Output" flag for the "Repeat_Text" variable, then click the Save button
B. Calling the Hello World Workflow
B1. Click the "Beginning_Flows" link in the path bar at the top of the editor
B2. Create a new Workflow and name it "Calls_Hello_World"
B3. In the Action Block menu on the right, click the User block. This is a menu of all of the other Workflows on the Plaint instance to which you have access. You can use these Workflows as blocks in other Workflows.
B4. Navigate into the "Beginning_Flows" folder, and drag the "Hello_World" block into the Workflow.
B5. Notice the "User_1" in the top of the "Hello World" block, this is the block name, and it will be attached to all of the output variables from this block. Click the chevron to show the output variables for the block.
You should see the output variable "$User_1.result" appear. You can use this variable as an input in subsequent blocks.
B6. Populate the input variables of the blocks:
i. Put text of your choice in the "Repeat_Text" input field of the "Hello World" block
ii. Replace "Hello, World!" with $User_1.result in the "Value" field of the "Assign" block.
B7. Run the Workflow. You should see your string appear as the workflow result.