cancel
Showing results for 
Search instead for 
Did you mean: 

Creating measure input control in SAC application

YanGerzon
Participant
0 Kudos

Hi,

Is it possible to create a measure input control in an Application?
In a story I see that option and it works fine but not when I create an application and create the same table based on the same model with the same dimensions and measures.

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

N1kh1l
Active Contributor

Gerzon,

You will need scripting to achieve it. Something like below.

// Put this in onInitialization event of the canvas

var measures = Table_1.getDataSource().getMeasures();
var selectedKey = "";
if (measures.length > 0)
{
  for (var i = 0; i < measures.length; i++)
  {
	  // Measure
    Dropdown_Measures.addItem(measures[i].id,measures[i].description);
    if (selectedKey === "" && i === 0) {
      selectedKey === measures[i].id;
      Dropdown_Measures.setSelectedKey(selectedKey);
      //console.log(["selectedKey ", selectedKey]);
    }
    //console.log(["CurrentMeasure ", measures[i]]);
  }
}

// Put this on on select of dropdown

Table_1.getDataSource().setDimensionFilter("Account", selectedKey); // Table_1 is table name and Account is the dimesnion. You can setMeasureFilter if its a measure based model.
YanGerzon
Participant
0 Kudos

Thanks this helps a lot.
What is the syntax for actually just getting the members of a measure?

Answers (1)

Answers (1)

N1kh1l
Active Contributor

Yes. You can populate a drop down list with all measures. Use the selected measure from drop-down to filter your charts/ table.

Regards

Nikhil

YanGerzon
Participant

Would You mind elaborating a bit?
I dont see the option of creating a measure input control like i can in a story.
I have to do it using code in the case of an application?
This is how it works in a story: