Using Data Actions Technical Object
Besides the Data Action Trigger widget you can also use the technical object Data Actions and the related script APIs to run short running data actions via scripts as well as set and read parameter values.
-
Using the data action trigger widget and related APIs
- Using the data actions technical objects and related APIs
-
set the value for a data action paramenter
-
read the value of the data action parameter
-
execute the data action
Before you can use the technical object Data Actions, there have to be data actions created already.
-
To create or edit a Data Actions technical object, you need the permission to edit the analytic application.
- To select a data action in the Data Action Configuration side panel you need the respective read permission for data actions.
-
To execute a data action, you need the respective execute permissions for the selected data action.
You need to add a data action technical object to the application to be able to use the related script APIs.
-
In the Scripting section of the Outline, select right next to Data Actions to add a data action.
The side panel Data Action Configuration opens with an empty description field where you can type in a meaninful description for the data action.
-
In the Data Action dropdown select one of the data actions that have been created already. The related data action parameters are displayed below.
- Enter the values for the parameters either using the member selection or by chosing the
given default value that has been set in the data action designer. Note
-
To execute a data action successfully, all parameters have to be filled with values. Either in the side panel Data Action Configuration or via the API setParameterValue.
-
The design of the data action itself can't be changed in the Data Action Configuration, only the parameter values can be set here to adjust the data action.
-
-
Click Done when you have finished setting the parameters.
For more information about data action parameters, see Add Parameters to Your Data Actions and Multi Actions.
-
executing data actions
function execute(): DataActionExecutionResponse;;
-
getting parameter values
function getParameterValue(parameterId: string): DataActionParameterValue;
-
setting parameter values
In the following example, a set of dimension member filters is assigned to a parameter of a data action. The code collects the relevant single value and multiple value dimension member filters into an array before the assignment operation. Exclusive filters are ignored, they aren’t supported by the data action.
Sample Codevar filters = table.getDataSource().getDimensionFilters(dimensionId); var filteredMemberIds = ArrayUtils.create(Type.string); for(var i = 0; i < filters.length; i++) { if (filters[i].type === FilterValueType.Single) { var singleFilter = cast(Type.SingleFilterValue, filters[i]); if (!singleFilter.exclude) { filteredMemberIds.push(singleFilter.value); } } else if (filters[i].type === FilterValueType.Multiple) { var multiFilter = cast(Type.MultipleFilterValue, filters[i]); if (!multiFilter.exclude) { filteredMemberIds = filteredMemberIds.concat(multiFilter.values); } } } dataAction.setParameterValue(parameterId, { type: DataActionParameterValueType.Member, members: filteredMemberIds });