cancel
Showing results for 
Search instead for 
Did you mean: 

SAC Application Designer: Script to read a value from a table column

11-02-2022 3:13 PM
rijin_baby61 Participant
5321 views 2 comments
0 Likes
SAP Managed Tags
Subscribe

I have a table as follows

I am trying to read values of a column to a variable and print the 3rd value in a text box. The column is a calculated measure hence numeric code.

var M12 = Table_8.getDataSource().getResultSet({[Alias.MeasureDimension]:"38850850-4017-4442-8008-019502419147"});
console.log(M12);
Text_12.applyText(M12[3][Alias.MeasureDimension].formattedValue);
but the output on text box is "undefined" .To debug i checked the content of variable M12

I think the content of ResultSet is empty.Can anyone help me to read the column values and print a specific value from array.Thank You.
0 Likes

Accepted Solutions (0)

Answers (1)

Answers (1)

JBARLOW
Active Contributor
0 Likes

Hi there, just tested this out

GM2 is a calculated measure:

The button contains the code below and writes the value 2,579,505.29 to the text box

*Edit - to write the 3rd value to the text box you need to use M12[2] as the array will start at 0 *

var M12 = Table_1.getDataSource().getResultSet({[Alias.MeasureDimension]:"22176336-1325-4884-a239-522753026413"});
Text_1.applyText( M12[2][Alias.MeasureDimension].formattedValue);
rijin_baby61
Participant
0 Likes

jbarlowjb

Thank you again for your help.

But it is strange that the solution isn't working for me

here is the code, this time I used a new column with numeric value and not percentage

var M12 = Table_8.getDataSource().getResultSet({[Alias.MeasureDimension]:"13464159-6383-4441-b313-278835384536"});
Text_12.applyText(M12[2][Alias.MeasureDimension].formattedValue);

I still get the text output as "undefined"

Regards