SAC Application Input "Textbox" filter

1.6k views Asked by At

I am currently getting introduced to SAC and i am looking to filter a table and its columns via a "input field".

I have seen guides on drop down boxes and sliders but not text input by the user.

I imagine the code is very similar?

thank you in advance for your time.

1

There are 1 answers

0
wAnd On

Solved. The following code will also include vague strings like "Smi" for Smith, Smithy or Smithers in example.

Make sure you paste this into your InputField on your analytic application.

var Input= this.getValue(); 

var i=0; 


var res=Table_1.getDataSource().getMembers("Dimension_Name_"); 


var filter_data = [""];
var a = 0;
for (i=0;i<res.length; i++) 

{
if (res[i].description.startsWith(Input))
{ 
filter_data[a] = res[i].description;    
a++;
} 

} 

Table_1.getDataSource().setDimensionFilter("Dimension_Name_",filter_data);

Hope this helps others that may run into this