Skip to Content
Technical Articles
Author's profile photo Rohit Chouhan (Deloitte)

Pass Input Control / FilterLine Value to Data Action Parameter in Analytical Application

The SAC story allows input control values to be passed to Data Action Parameters, but this is impossible with the Analytical Application. But there is a perfect way to accomplish this.

There is no function available to pass Input Control or FilterLine values, but there is one perfectly good reason to do this.

  1. Create Data Actions from sidebar (not from insert tab) on Analytical Application, Add your data action name.
  2. Create new Button, and add this mention code below in onClick()
  3. Replace your Dimension and Data Action Parameter Id, use this code.
Application.showBusyIndicator("Preparing for execution..."); 
var filter = Table_1.getDataSource().getDimensionFilters("your_table_dimension");
for (var i = 0; i < filter.length; i++) {
	if (filter[i].type === FilterValueType.Single) {
		var singleFilterValueCC = cast(Type.SingleFilterValue, filter[i]);
		DataAction_1.setParameterValue("data_action_parameter_id", [singleFilterValueCC.value]);
	} else if (filter[i].type === FilterValueType.Multiple) {
		var multiFilterValueCC = cast(Type.MultipleFilterValue, filter[i]);
		DataAction_1.setParameterValue("data_action_parameter_id", multiFilterValueCC.values);
	}
}

DataAction_1.execute();
Application.refreshData();
Application.hideBusyIndicator();
Application.showMessage(ApplicationMessageType.Success,"Executed Successfully");

Passing to Input Control

Read this blog to pass your input control values to data action, Read Article

Conclusion

Data Action is very useful tool in Sap Analytical Cloud for large calculation, Some of feature In Analytical Cloud its little difficult in Back-end side. So using this way we can use Data Action to pass filters value to Data Action Parameter.

Assigned Tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Rijin Baby
      Rijin Baby

      Rohit Chouhan

      Thank you for this great article.

      I am trying to use the following code for the filter, I use input control instead of table

      var filter = InputControl_1.getInputControlDataSource().getActiveSelectedMembers();
      

      But using this I see the following error

      Can you suggest me the correct way to use this? Thank You

       

      Author's profile photo Rohit Chouhan (Deloitte)
      Rohit Chouhan (Deloitte)
      Blog Post Author
      var filter = Table_1.getDataSource().getDimensionFilters("dimension_name");

       

      Use Table, not InputControl

       

      Example:-

      var filtersVersion = Table_1.getDataSource().getDimensionFilters("SCENARIO");
      for (var ver = 0; ver < filtersVersion.length; ver++) {
          if (filtersVersion[ver].type === FilterValueType.Single) {
              var singleFilterValueVersion = cast(Type.SingleFilterValue, filtersVersion[ver]);
              DataAction_1.setParameterValue("TargetVersion", [singleFilterValueVersion.value]);
          } else if (filtersVersion[ver].type === FilterValueType.Multiple) {
              var multiFilterValueVersion = cast(Type.MultipleFilterValue, filtersVersion[ver]);
              DataAction_1.setParameterValue("TargetVersion", multiFilterValueVersion.values);
          }
      }