streamAction

Forms: Stream Action

A Stream Action carries out the following actions in the following sequence. All of the steps are optional and are only carried out if configured on the appropriate tab.

  1. Open a Form View to allow the user to provide some parameters for this action.
  2. Open a File Explorer window to allow the user to navigate to a directory and select one or more files.
  3. Evaluate a set of Context Parameter expressions configured on the Context Parameters tab. The Context Parameter expressions can refer to any values entered on the Form View using the notation _prompt.<Form Field Name>. The Context Parameters can also refer to any attributes of any records selected on the view or dashboard from which the action was initiated using the notation <View name or alias>.<Attribute name or alias>.
  4. Evaluate the file upload tag expression. This expression can refer to any values entered on the Form View using the notation _prompt.<Form Field Name>, the values of any Context Parameters using the notation <i>_context</i>.<ContextParameter Name> and any attributes of any records selected on the view or dashboard from which the action was initiated using the notation <View name or alias>.<Attribute name or alias>.
  5. Upload the selected files and mark them with the evaluated tag value so that they can be retrieved later by suitably configured File Collector.
  6. Evaluate the validation expression configured on the Validate Action tab. This expression can reference any values entered on the Form, the values of any Context Parameters (using the notation <i>_context</i>.<ContextParameter Name>) and any attributes of any items selected on the view or dashboard from which the action was initiated. If the validation expression generates any error messages (including by using the Error function) then no further action processing will take place.
  7. Retrieve a set of records from the database for this Stream. The records retrieved will either be based on a filter specified on the Filter tab or, if no filter is specified, the records selected on the view from which the action was initiated. If a filter is specified then any expression on the filter can refer to the Form View fields, Context Parameters or attributes of items selected on the view or dashboard from with the action was initiated. This step will only be carried out if the user has selected either the Update or Delete Action on the Item Updates tab.
  8. Carry out any stream item updates configured on the Item Updates tab. Update and delete actions will be applied to the records retrieved from the database in the previous step. When carrying out Insert or Update actions each Stream Action Attribute expression will be evaluated in turn to calculate the new value for that attribute. These expressions can refer to the Form View values, the Context Parameters, the values of any attributes of items selected on the view or dashboard from with the action was initiated or, for Updates, the values of attributes from the records retrieved from the database. To refer to values of attributes retrieved from the database simply refer to the attribute name without any prefix. Please note, even where a record retrieved from the database is based on a record selected on a view, the values on the record retrieved from the database may differ from those on the view as the record in the database may have been updated by another user since the view was last refreshed. If any attribute expression fails, or an error message is sent using the Error function, then that record will not be Updated, Deleted or Inserted. However, if multiple records are being updated, a failure of one record will not prevent the others from being updated or deleted.
  9. Run the configured task plan. Any Context Parameters can be referenced by any expression run during that task plan.
  10. Open another dashboard. Any filter of any view on that dashboard can reference any Context Parameters set on this action. If the specified dashboard is already open it will be brought to the front and refreshed rather than a second instance of the dashboard opening.
  11. Close the current dashboard from which the action was initiated.

Once configured, a Stream Action can be dragged and dropped onto Stream Views associated with the Stream on which the Action is configured to create a set of Action Buttons which appear on the top of the Stream View.

The following are the top-level configuration parameters for Stream Actions:

Form: Stream Action Details

The following fields are configured on the Details tab:

Field Description
Name The name of the Stream Action.
Display Name The name that will be used to display this action on a Stream View
Stream Name The name of the parent Stream that this action belongs to
Form View

This dropdown list shows all Form Views associated with this stream. If a Form View is selected then it will be presented prior to this action being run to allow the user to enter values to be used in Context Parameter, Validation, Filter or Action Attribute expressions. These values are referenced in those expressions by preceding the field name from the form with '_prompt'. For example if there is a field on the form with the label "Name" then the value entered in that field by the user can be referenced in subsequent expressions as _prompt.Name.

If the Stream Action selected on the Item Updates tab is 'Update' then the form will be pre-populated with the values from the selected record; where multiple records are selected then only those values which are common to all the selected records will be displayed. If any other Stream Action is selected then the form fields will initially be blank.

File Upload

A Check box to determine whether a Tag Expression field is displayed. The tag expression can refer to any values entered on the Form View using the notation _prompt.<Form Field Name>, the values of any Context Parameters using the notation _context.<ContextParameter Name> and any attributes of any records selected on the view or dashboard from which the action was initiated using the notation <View name or alias>.<Attribute name or alias>.

If a tag expression is provided then when the action is run a file explorer dialog will appear to allow the user to navigate to a directory and select one or more files. These files will be uploaded to the File Upload Directory specified in the System Configuration table and tagged with the evaluated value of this tag expression so that they can be retrieved later by suitably configured File Collector.

List of names of uploaded files can be accessed through <i>_files</i> variable.

Run Selected TaskPlan A Check box to determine whether a combo box is displayed which is then used to allow the user to choose a task plan to be run. Any expression evaluated during this task plan can reference any Context Parameter.
Open Post Dashboard A Check box to determine whether a combo box is displayed which is then used to allow the user to choose a dashboard to be opened once the action has completed. Any filter of any view on that dashboard can reference any Context Parameters set on this action. If the specified dashboard is already open it will be brought to the front and refreshed rather than a second instance of the dashboard opening.
Close Parent Dashboard A Check box to determine whether the Parent Dashboard should be closed after the Action is finished.
Prevent Parallel Processing A Check box to determine whether the Action can be submitted again before the previous run is finished.
Show progress indicator after (ms) A number of milliseconds which need to pass after the Action is submitted before the progress indicator is shown .
All Users Can Run Action If checked, this specifies that all users can run this Action provided they have the basic privilege to run stream actions. If this field is not checked, then access to the stream action is controlled by adding user groups onto the stream's "User Groups" tab.
URL Expression A URL which will be open when the Action has completed. This may be provided as a fixed URL or as an expression. The expression can reference the Form fields, Context Parameters or attributes of Records selected on the view or dashboard from which the action was initiated.

The following fields are configured on the Context Parameters tab:

Field Description
Name The name of the context parameter
Expression

An expression for the context parameter. The Context Parameter expressions can refer to any values entered on the Form View using the notation _prompt.<Form Field Name>. The Context Parameters can also refer to any attributes of any records selected on the view or dashboard from which the action was initiated using the notation <View name or alias>.<Attribute name or alias>

The values returned by the context parameter expressions can be referenced by the Validation expression, the Filter, the Maximum and Minimum Items expressions, any Stream Action Attribute expressions and any dashboard opened by this action.

The context values are referenced using the syntax _context.<context parameter name>.

For example, imagine that you have a view called 'customers' which shows a list of customers including the account id, name and other account details and you want to create an action button to open up another dashboard, containing a view called 'invoices', which will show the invoices for the specific customer selected on the 'customers' view. To do this you would add an action button to the 'customers' view and configure it to open the dashboard containing the 'invoices' view. You would then add a context parameter called 'account' to the action with the context parameter expression set to 'customers.account_id'. On the background filter of the 'invoices' view you would then set the filter to only select those invoices whose account_id was equal to '_context.account'.

Unlike stream action attribute expressions, context parameter expressions can evaluate to a list of values as well as single values.

The usual message functions debug(message), info(message), warning(message), and error(message) are all available to be used in these expressions and will result in messages being written to the system console logs.

However special attention should be taken when using the error(message) function as this will also STOP the action from being completed.


The following field is configured on the Validate Action tab:

Field Description
Validation Expression The validation expression is evaluated at the start of any stream item Insert or Update actions and if the validation expression generates any error messages (using the error function) then the action is abandoned. The validation expression is not used to decide whether or not to run the selected Task Plan

A number of internal variables are available in these expressions:

  • _this: A reference to all the selected records within the view to perform the action on.
  • _prompt: A reference to all the user prompted action attributes.

The usual message functions debug(message), info(message), warning(message), and error(message) are all available to be used in these expressions and will result in messages being written to the system console logs.

However special attention should be taken when using the error(message) function as this will also STOP the action from being completed.

e.g To validate that the sum of the selected record amounts equate to zero before allowing the action to be executed.

if(sum(_this.amount) == 0, info('OK'), error('Not performing Action as the Sum does not equate to zero'))

e.g To validate that the user entered comment is at least 10 characters long, else write a warning to the log.

if(stringLength(_prompt.UserComment) >= 10, info('OK'), warning('Comment should be at least 10 characters'))

Note that you can also reference selected records from other dashboard views by using their view names:- i.e if(sum(ACCTS.amount) == 0, info('OK'), error('Error as ACCTS Sum does not equate to zero'))


The following field is configured on the Result tab:

Field Description
Result includes Warnings If ticked, warning messages generated by the Action in the Console log will be displayed as part of the result message.
Result includes Errors If ticked, error messages generated by the Action in the Console log will be displayed as part of the result message.
Result Message

The Result Message is displayed when the Action has completed and may be used to provide a summary of the Action.

The message can contain multiple Expressions inside {} brackets - these Expressions are evaluated in turn before the message is displayed.

E.g.

Action {_action} failed with {_errors} errors and {_warnings} warnings.

A number of internal variables are available in these expressions:

  • _error: Details of the error messages generated.
  • _errors: The number of error messages generated.
  • _warning: Details of the warning messages generated.
  • _warnings: The number of warning messages generated.
  • _messages: The number of warning messages generated.
  • _taskPlan: The name of the Task Plan that the Action ran (may be null)
  • _runId: The runId of any Stream data generated by this Action (may be null).
  • _action: The name of the Action.
  • _file: Details of files processed (imported or exported) by the Action.
  • _fileCount: The number of files processed by the Action.

The following fields are configured on the Item Updates tab:

Field Description
Stream Item Action This drop down has four options:
  • None
  • Update
  • Insert
  • Delete

Please be aware that a Deletion action is non-reversible. In some circumstances it may therefore be better to select an Update action to simply mark the records as 'deleted' and then configure an Archive Task to remove records marked as deleted after a certain period of time. This will provide a window of opportunity for these 'deletions' to be reversed manually if they are made by mistake.

Filter Type This drop down has three options:
  • Selected Items - Action will only apply to the records selected on the view from which the action was initiated.
  • View Filter - Action will only apply to the records shown on the view from which the action was initiated.
  • Action Filter - Action will only apply to the records retrieved by the filter defined in the Filter tab.
Maximum Items Expression This field appears if the update action selected is Update or Delete. The expression entered here must evaluate to a positive whole number. The expression can reference any fields entered on the Form View associated with this action, any attributes of any records selected on the view or dashboard from which the action was initiated and any of the Context Parameters configured for this action.

If the number of items selected on the view from which this action is initiated, or retrieved by the filter configured on this action, is greater than this number then an error message will be generated and no updates or deletes will take place.
Minimum Items Expression This field appears if the update action selected is Update or Delete. The expression entered here must evaluate to a positive whole number. The expression can reference any fields entered on the Form View associated with this action, any attributes of any records selected on the view or dashboard from which the action was initiated and any of the Context Parameters configured for this action.

If the number of items selected on the view from which this action is initiated, or retrieved by the filter configured on this action, is less than this number then an error message will be generated and no updates or deletes will take place.
Action Attributes

A Grid showing all the associated Stream Action Attributes that form part of this stream action. See the Stream Action Attribute form.

This grid only appears if the Stream Item Action selected is Update or Delete.

The Filter tab allows the user to enter a filter to specify the records against which any Update or Delete actions should be applied. Any expressions on this filter can reference the Form View fields, Context Parameters and any attributes from any record selected on the view or dashboard from which this action was initiated. The tab is visible only if the selected Filter Type (in the Item Updates tab) is the 'Action Filter'.

The following field is configured on the User Groups tab:

Field Description
User Groups A list of User Groups permitted to run this Action

The following field is configured on the Description tab:

Field Description
Description Description of the stream action

Form Icons

The form provides the standard form icons.

Displays the Stream that this action belongs to.

The form also provides the following icons on the Stream Action Attributes tab:

Deletes the selected object from the list.

Adds a new Stream Action Attribute.

Shows the list of attributes that can be added as stream action attributes

See Also