PhixFlow Help

8 Actions to run tasks – using selected row values

By the end of this section you will be able to:

  • Create an action that runs a task plan
  • Use context variables in a model

In this exercise you will create an action that takes a selected file from a list and loads that file into PhixFlow.

The files used in this exercise can be found in the input files, at: …_ _inputData\BillingReports2

Although you will create a process that reads copies of these files from the server. The input directory expression of the file collector in the example is already set up to read files from the correct location on the server.

  • Open the model Dashboards and Forms 15. Actions to run tasks – in this model, there is a stream and file collector set up to read billing reports. There is also a stream Billing Report List that simply holds a list of file names
  • Open the dashboard Manual billing reports load – this dashboard contains a view of the list of file names
    • Actions have already been added to maintain the list of file names – records can be added, updated and deleted (this is simply a view on the stream Billing report list)

You will add an action to run the file load based on the record selected from the list of file names. First you need to create a task plan to load the reports:

  • Create a task plan called Load billing report
  • Add an analysis task to run the stream Billing reports
  • Run the task plan to check that it loads data into the stream

Set the element name of the view on the dashboard:

  • Open the dashboard Manual billing reports load
  • Right click anywhere on the view and go to Dashboard Options → Show Element Details
  • Set the Name to: FileList

Now create the action:

  • Open the configuration form for the stream Billing Report List
  • Go to the Actions section
    • Press  to create a new action
    • Give the action the following configuration:
      • Name: Load billing report
      • Display Name: Load report
      • Go to the section Run Task Plan
      • Tick Run Selected TaskPlan
      • Press
      • Press - Show the list of Task Plans
      • Drag the task plan Load billing report into the list
      • (Leave the expression blank - a blank expression means that the task plan will be run every time the action is run)
    • Add a context parameter to the action:
      • Go to the Context Parameters section
      • Press 
      • Configure a context parameter with the settings:
        • Name: FileName
        • Expression: FileList.FileName
          • Note that to reference the selected row, we use the Element Name of the view on the dashboard
        • Press 
      • Press  in the main action configuration form
  • To associate the action with the view:
    • Open the configuration form for the view File List on the stream Billing Report List
      • Go to the Menu Items section
      • Press  - Actions
      • Drag the action Load report into the list of actions on the view
      • Press  to apply your changes

Now update the file collector so that it loads the file selected in the dashboard:

  • Open the configuration form for the file collector Manual billing reports load load by double clicking it on the model view
  • Update the File Pattern Expression to: _context.FileName
  • Press 

Test the action:

  • Open the dashboard Manual billing reports in app mode
  • Add at least one row to the file list (remember you can see the list of files available in the input directory), e.g. billingReport_1.txt
  • Select the row, and run the action Load report
  • Check that the data for that file (and only that file) was loaded
    • In design model, open the Console
    • In the middle view Completed Tasks remove the current filter (by default this is filtered to not show task plans that were triggered by an action)
    • You should see the task you just set off - double click on this to see messages
    • Go into to the Imported/Exported Files tab to check that the file loaded was the one you selected
    • Check the contents of the stream Billing reports

Please let us know if we could improve this page feedback@phixflow.com