on 05-30-2023 9:48 AM
Hi,
Does anybody have the textbook way of iterating through a table of data in SAC that has 2 dimensions and 2 measures?
I want to be able to check if the dimension is say ="testCell_1" and if it is put measure 1 value into a variable and measure 2 value into a variable.
I have seen many examples of doing this but only with a single measure?
This is how I am trying to tackle it but struggling to get the measure data...
Thanks in advance for any help offered here...
var selections = table_Dummy.getDataSource().getDataSelections();
for (var a=0;a<selections.length;a++) {
//get my 2 dimensions - works fine
var testCell = table_Dummy.getDataSource().getResultMember("Test_CellDISPLAY_KEY",selections[a]).id;
var state = table_Dummy.getDataSource().getResultMember("CategoryDISPLAY_KEY",selections[a]).id;
var measure1Value = table_Dummy.getDataSource().getData() - help here
var measure2Value = table_Dummy.getDataSource().getData() - help here
andrewbarlow
Have you tried the getResultset()API ?
Nikhil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi nikhil_1486
This seems to work Nikhil...
I had to change the index as it looks like the second measure goes on a separate row - that is the bit that I was missing I think
var resultSet = table_Dummy.getDataSource().getResultSet();
console.log(resultSet);
for (var a = 0;a<resultSet.length;a=a+2) {
var testCell = resultSet[a]["Test_CellDISPLAY_KEY"].id;
var state = resultSet[a]["CategoryDISPLAY_KEY"].id;
var h = resultSet[a][Alias.MeasureDimension].formattedValue;
var m = resultSet[a+1][Alias.MeasureDimension].formattedValue;
console.log(h); //I want this to be value 1 of the row with a as the row index
console.log(m); //I want this to be value 2 of the row with a as the row index
User | Count |
---|---|
70 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.