Process Action Example Flow Chart

Process Action Example Flow Chart

This example will provide you with a description of how to process files individually using a Process Action’s “Command Properties” field. This example will also guide you through you the steps of setting up a Process Action and configuring it to run a program.

In this example you will create a File Trigger that searches for “.txt” files in a specific directory. Once these files are found they will be passed into a For Each Collection Element Action which begins iterating through the collection of file names one at a time. As each file name is used it is passed into the Process Action’s “Command Properties” field where it is then used in the Process Action’s “Command” field and run. Once the collection of file names is exhausted, an Else flow is followed.

Running this Example from the XML File

If you wish to run this example using an existing flow chart, create a new flow chart and select the “Import one flow chart from XML file:” check box. Then click the  icon to browse for the “.ffc” file to import. Select the flow chart located in the same directory as this example and click “Open” then click the  Ok button. See Figure 1 below.

       
Figure1: Importing a Flux Flow Chart

Getting Started

To get started, run the Flux Designer. You can start the Designer by clicking the blue highlighted hyperlink located directly above Figure 2 below. If your PDF viewer does not support the hyperlink functionality, you can run the Designer by double-clicking the “flux-designer.bat” file located within your Flux installation directory, or by running the “Flux Designer.exe” icon also located within your Flux installation directory or start menu for Windows users.

       
Figure2: Flux Designer Logo

Once you have the Flux Designer running, open the project that is located within the same directory as this example resides in, “/examples/end_users/process_Action”. To open the project, click the,, icon, browse to the previously mentioned directory, open the “fluxproject.fpr” file.

Next, make a new flow chart, by either going to the “file” pull down menu at the top left of the screen and selecting “New”, or by click on the icon   directly below it to bring up the “New” window represented in Figure 3 below. Select the “New Flow Chart” option and click .

       
Figure3: "New" Options

Name the flow chart “Process Action” and click Ok.

Creating Actions

Next, create the actions used in the flow chart. Locate the actions and triggers needed within the “Action” and “Trigger” tabs to the left of the drawing canvas as shown in Figure 3 below. Drag the actions listed below in the bulleted list into your drawing canvas and arrange them according to Figure 4 displayed below.

       
Figure4: "Action" and "Trigger" Tabs

The bulleted list below gives you the following information: The name of the action or trigger you need, the category that the action or trigger is located under, and how many instances are needed for this example.

 “Actions” Tab:

· Action Name: “For Each Collection Element Action”, Category: “Core”, Quantity: 1

· Action Name: “Console Action”, Category: “Core” , Quantity: 2

· Action Name: “Process Action” , Category: “Most Popular”, Quantity: 1

 “Triggers” Tab:

· Trigger Name: “File Exist Trigger”, Category: “Most Popular”, Quantity: 1

       
Figure5: Action's Layout

Setting up Flows

Next we need to create the flow from each action and trigger. Use Figure 6 displayed below as a guide to set up the flows for your flow chart. Follow the list of instructions below to create the flows.

  1. Click the blank white space within your drawing canvas.
  2. Click and hold on the action you wish to draw the flow from.
  3. Drag your cursor to the action you wish to draw the flow to and release.

       
Figure6: Beginning Flow

Once your flows are set up we can configure them. Let’s start by creating an Else flow from the “For Each Collection Element Action” to “Console Action 2”. You can do this step by right-clicking on the flow between these two actions, when you do the menu represented in Figure 7 below will appear.

       
Figure7: Flow Menu

Select the “Edit flow condition” option on the menu. A window similar to Figure 8 below will appear.

       
Figure8 Flow Condition Menu

Select the “Else Condition” option in the “Flow Condition” window and then click the  button. Your flow will now look like Figure 9 below.

       
Figure9: Else Flow

Next, we will need to create some runtime data maps on three of our flows. First, let’s start with the flow from “File Exist Trigger” to the “For Each Collection Element Action”. Right-click this flow and the menu represented in Figure 7 above will appear.

Select the “Edit runtime data map” option within the menu and Figure 10 shown below will appear.

       
Figure10: Edit Runtime Data Map Window

Click the  button and the “Type” and “Name” fields will become editable.

Make sure the first “Type” field reads “Flow Context”. Under the “Name” field type in “RESULT.file_name_matches”. Make sure the second “Type” field reads “Action”. Click the second “Name” field and a drop down menu will appear, and then select the “Collection” option. Use Figure 11 below as a guide. 
Figure11: Edited Runtime Data Map for the “File Exist Trigger” Flow

Once you have this runtime data map configured click the Ok button.

You now have your flow configured to put all file names that are found in a specified directory into the collection element.

Next, let’s edit the flow from the “For Each Collection Element Action” to the Console Action named “Console Action”. Navigate to the “Edit Runtime Data Map” window as shown above in Figure 9 the same way as the last flow except using the next flow.

Once you are at the “Edit Runtime Data Map” window click the  !data_010.png!  button to add a new runtime data map.

Make sure that the “Flow Context” option is selected under the first “Type” field. Under the first “Name” field type in, “FILENAME”. Next, make sure the second “Type” field has the “Action” option selected. Finally, select the “Message” option in the drop down menu under the second “Name” field. Use

Figure 12 below as a guide.

Once you have finished editing the runtime data map click the Ok button.

       
Figure12: Edited Runtime Data Map for the "For Each Collection Element" Flow

You now have a flow that takes the information from the “Collection” in your “For Each Collection Element Action” and relays it to the “Console Action” to print out on your console.

Next, we need to edit the last flow with another runtime data map. So, navigate to the “Edit Runtime Data Map” window using the flow from the “Console Action” to the “Process Action”.

Once you have reached the “Edit Runtime Data Map” window click the   button to add a new runtime data map.

The first “Type” field should read “Flow Context”. Edit the first “Name” field to read “FILENAME”. The second “Type” field should read “Action”. Select the “Command Properties” option in the second “Name” field’s drop down menu. Use Figure 13 below as a guide.

       
Figure13: Edited Runtime Data Map for the “Console Action” Flow

Once you have finished editing the runtime data map click the  button.

You now have a flow that relays the file name to the “Command Properties” field of the “Process Action”.

Once you have completed editing all the flows your flow chart will look like Figure 14 below.

       
Figure14: Edited Flows

Renaming Actions

Next, let’s give the actions more descriptive names. This will keep us from getting confused on which actions we are dealing with later in the example as well as more descriptive names as a reference. Follow the steps below to edit an action’s name.

To edit an actions name:

  1. Right-Click on the action whose name you wish to edit. The menu shown below in Figure 15 will appear.

       
Figure15: Editing the Action Name

  1. Click the “Edit action name” option on the drop down menu.
  2. Type in the name you wish to give the action.

Action Names

Use the bulleted list below as a reference to rename your actions.

·  “For Each Collection Element Action” to “File Iterator”.

· “Console Action” to “Print File Name”.

· “Console Action 2” to “Finished Processing”

· “Process Action” to “Open File”

When you have renamed your actions your flow chart should look similar to Figure 16 shown below.

       
Figure16: Renamed Actions

Editing Action Properties

File Exist Trigger

First, we will start with the “File Exist Trigger”. We will need to configure this trigger to look in a specific directory for a specific type of file. Let’s start by clicking on the trigger in the drawing canvas. Once the trigger is highlighted its “Action Properties” panel should appear on the right of your screen. Select the “File Criteria” field within the panel and click the  box that appears to the right of the field. The “File Criteria Editor” window, represented by Figure 17 below, will appear.

       
Figure16: File Criteria Editor

Click the  button on the “File Criteria Editor” window and the “File Criteria” window represented by Figure 18 below will appear.

       
Figure17: File Criteria Window

From the “File Criteria” window you can edit the fields for what files to use and where to find them. Start by editing the “Base Directory” to point to the “Files to be Processed” directory, located in the "examples/end_users/process_action/Files to be Processed" directory. You may also set this directory as a relative path.

Next, add an include filter into the “Include” field to read “*.txt”.

If you are unclear on how to edit these fields see the “file_triggers” example located in your Flux directory, under the “/examples/end_users/” directory.

If you used the “Basic” setup for the “File Criteria” then click the Finish button to complete the setup. If you used the “Advanced” setup for the “File Criteria” then click the  button.

Click the Ok on the “File Criteria Editor” window to bring yourself back to the Main Flux GUI.

Once you have completed these steps you will have a “File Exist Trigger” that searches for text files in the “Files to be Processed” folder and returns their names.

For Each Collection Element Action

Next, we will configure the For Each Collection Element Action, named “File Iterator”, to use the variable “FILENAME” that we used in our runtime data maps in the flows that we previously setup in this example. Start by clicking on the “File Iterator” For Each Collection Element Action within your drawing canvas. Its “Action Properties” panel will appear to the right of your screen.

Next, select the “Loop Index” field within the panel. The value in this field should be set to “i” by default. Change this value to “FILENAME”.

Once you have changed the “Loop Index” value, your flows will be able to use that value throughout your flow chart.

Console Action

Next, let’s edit the “Finished Processing” Console Action. Start by selecting the “Finished Processing” Console Action in your drawing canvas. Its “Action Properties” panel should appear to the right of your screen.

Edit its “Message” field, located in its “Action Properties” panel, to read, “Processing is complete.”

Process Action

To finish configuring this flow chart we need to instruct the Process Action “Open File” to run the file names that will be passed into the Process Action’s “Command Properties” upon runtime. Let’s start by selecting the “Open File” Process Action within your drawing canvas. Once the Process Action is highlighted its “Action Properties” panel should appear at the right of your screen.

Within the “Action Properties” panel select the “Command” field to edit it and type into the field “cmd /c ${FILENAME}”. This syntax will access your system’s command shell and run the file name passed into the variable “FILENAME” from the flow context.

Creating a Flux Engine

Next, create a Flux engine. To create an engine, simply click the following blue highlighted hyperlink: Start Flux Engine. If your PDF viewer does not support hyperlink functionality, open the “start-unsecured-flux-engine” batch or shell file, depending on the platform you are running Flux with, located within your Flux installation directory. For Windows users, you can use the "Start unsecured engine" option within the start menu, under the Flux and Flux Engine tabs, to create and run a Flux engine.

Next, return to the Flux Designer and move your cursor over the “Flux Engines” tab located at the left of the screen.

Click the  button at the top of the “Flux Engines” tab and the window shown in Figure 19 below will appear.

       
Figure19: Job Scheduler Engine Setup

Click on the “Advanced” tab at the top of the “Flux remote engine” window and click .

You should be back at the Flux main screen. Look at the “Flux Engines” tab again. The engine you just started should look like Figure 20, shown below.

       
Figure20: Indicator for running Engine.

Running the Flow Chart

Next, export your flow chart to the engine. You can do this step by clicking on the  icon at the top right of the Flux main screen. You may also export a job by clicking on the “Export” menu at the top of the screen and selecting “Export to remote job scheduler engine”. This menu is represented by Figure 21 below. Another way to export your job is by right-clicking on your drawing canvas and selecting the “Export to remote job scheduler engine” option. The menu and option are shown below in Figure 22.

       
Figure21: Export Menu

       
Figure22: Drawing Canvas Options

Click OK in the window represented by Figure 23 below.

       
Figure23: Export to Engine

A confirmation window, illustrated below as Figure 24, will appear if the job was successfully exported. Click the Ok button on the confirmation message. If there is an error message, look over this example carefully, and correct any mistakes made.

       
Figure24: Successful Export of Job

Your job should now be running. If you watch the command prompt your engine is running on you will see the first name of the first file in the “Files to be Processed” directory. After the file name is displayed on your command prompt a “.txt” file will open on your machine. Edit this file if you wish, and then exit out. The job then moves onto the second file to be processed. The file name is printed out on your console and the file opens for editing. If you exit this file the same will happen with the next file. This behavior continues until all files have been processed in the specified directory, then the Else flow is followed and the job ends.

Once this example is completed, you can shutdown your server. If your PDF viewer does not support this hyperlink functionality, locate and run the “shut-down-unsecured-flux-engine” batch or shell file within your Flux installation directory, depending upon which platform you are running Flux on.

 
 
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.