cancel
Showing results for 
Search instead for 
Did you mean: 

Sap Analytics Cloud insert Dynamic Comments in a client calculation Dimension Comment

0 Kudos
333

Hello everyone,

what I am trying to achieve is to insert some values in a Dimension Comment Column dinamically based on a condition,

I want to insert into the "Dimension Comment" Column of the right table a comment which contains the value of the VAT measure of the Left table, for the same id between Legal Entity and Intercompany (eg. Intercompany BD01 should contain 58,472,55 in the Dimension Comment column)

I have written this code onInitialization event:

var selections = Table_8.getDataSource().getDataSelections();

var seltab1=Table_8.getDataSource().getResultSet(); //this contains the resultset of the left table

var seltab2=Table_9.getDataSource().getResultSet(); //this contains the resultset of the right table

for ( var i=0;i<seltab1.length;i++) //this loops on the left table

{

for(var j=0;j<seltab2.length;j++){ //this loops on the right table

if(seltab1[i]["Legal_Entity"].id===seltab2[j]["Intercompany"].id){ //if the ids are equal

if(seltab1[i][Alias.MeasureDimension].description==="VAT"){ //if it's the measure VAT

var dataCell1=Table_8.getDataSource().getData(selections[i]); //get that value

var val=dataCell1.rawValue;

Table_9.getComments().setDimensionComment(seltab2[j],val);

//set the comment with the taken value on the current selection

}

}

}

}

But it doesn't work, the applications goes in script error...

the value is taken correctly, the code goes well til the instruction "var val=dataCell1.rawValue;"

There's something wrong in the way I'm passing the current selection...

Can anyone help me correct my code?

Many thanks,

Best Regards.

Filomena.

Accepted Solutions (0)

Answers (1)

Answers (1)

N1kh1l
Active Contributor
0 Kudos

filomena_sap_1997

filomena_sap_1997May be you should try to console.log(val) and console.log(seltab2[j]) and see what kind of values you are getting in those 2 variables. It will help you to understand your error better.

Br.

Nikhil