cancel
Showing results for 
Search instead for 
Did you mean: 

Lumira Designer 2.2: Filtering records in crosstab by key figure value

0 Kudos

Hi everybody,

I would like to know how could I filtering/hide records in crosstab by values of a key figure via scripting in Lumira Designer 2.2. For example, I created a crosstab (data source = BEx query) with 70 entries, 50 records with values 2-10, another 20 entries with value 1. After "On Element Clicked" of a created button the result in crosstab should only show all 20 entries with value 1. Any idea?

Best regards,

Steffen

View Entire Topic
0 Kudos

Hi Emily,

I'm impressed, thank you for your quick response. I tested your code. Unfortunely the crosstab shows still all 70 entries. Do you see any wrong part in source code at first appearance? Kind regards.

//create an array with all members of a chosen dimension (NOT a measures dimension)
var array = DS_15.getMembers("ZI_KNROPP", 200000000);

//create an empty string for filtering your data source
var listFilter = "";

//for each member of the array of your dimension, check if it matches the input value
array.forEach(function(element, index) {

	if(DS_15.getData("", {"(MEASURES_DIMENSION)":"00O2TMGPPF4ASYPCUWEZQ1WIK","ZI_KNROPP":element.internalKey}).value == 1){
		 listFilter = listFilter + element.externalKey + ";"; 
         }
});

//filter the datasource by the updated listFilter list of external keys
DS_15.setFilterExt("ZI_KNROPP", listFilter);

Hi Steffen,

Sorry for the delayed response. One issue I ran into when I tried to run this on a different crosstab was that it didn't work with more than one dimension in the data source. I ended up adding the script to remove the other dimensions before running the above script, and then adding the dimensions back to the rows when I was done.

<DataSource>.removeDimension(<dimension_1>);
<DataSource>.removeDimension(<dimension_n>);

//add the previous script

<DataSource>.addDimensionToRows(<dimension_1>);
<DataSource>.addDimensionToRows(<dimension_n>);