cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the values of a measure using scripts? SAC

kevin_structum
Explorer
0 Kudos
4,151

Hi All,

I have been searching, on every page and every pdf of documentation but I have not been able to get the values of a measure.

That is, I have a table with different measurements, and I need to extract the values of one of its columns and send it to an array, so that when printing the result on the console it says something like:

0: 123456

1: 212345

2: 312345

3: 412345

4: 512345

or well, something similar but only with the values, no description, id or parentId

I hope you can help me, thanks

View Entire Topic
JBARLOW
Contributor

Using a table with 1 dimension & 1 measure this seems to work

var arr = Table_1.getDataSource().getResultSet();
var value = ArrayUtils.create(Type.number);
for (var i=0;i<arr.length;i++) {var string = arr[i][Alias.MeasureDimension].formattedValue; var number = ConvertUtils.stringToNumber(string); value.push(number);} console.log(value);
kevin_structum
Explorer
0 Kudos

Thank u James

anandhu1234
Explorer
0 Kudos

Hi James,

First of all thank you for your response , it was really helpful while trying to implement a usecase in the optimized story.

My question is, can I create measures through scripting by accessing each values from the result set or change the description of calculated measures through scripting

thayumanavan
Participant
0 Kudos