Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9730

Re: How to choose multiple members of a dimension directly and set them as column in a chart?

$
0
0

Hi Shuang,

 

I hope I understood correctly, if not we can refine .

  • you have some selection UI (dropdown box for example) where you have list of years. the outupt is always a year...
  • then, you want to create a longer string of 52 weeks (with the format yyyy.ww) and pass as a filter.

 

passing as a filter should be simple, DS_1.setFilter(dim, <the-string>);

 

how to make the string, here a simple variant - I have used the Array component (Design Studio SDK: Array Util Component). In case you do not want to use any SDK, just write - I show you how to create an array without SDK.

 

exxample is located also in this script (based on 1.3 SP1):

     Release Adding Example for Filtering on Weeks · KarolKalisz/DesignStudioBiAppRepository · GitHub

     Name:SCN_FILTER_WEEKS

 

Sample code:

 

you need to fill in the dropdown (in my case in onStartup):

 

DROPDOWN_1.addItem("--seelct--", "Select Year ...");
DROPDOWN_1.addItem("2012", "Year 2012");
DROPDOWN_1.addItem("2013", "Year 2013");
DROPDOWN_1.addItem("2014", "Year 2014");
DROPDOWN_1.addItem("2015", "Year 2015");

and then on selection, this code will bring you back the filter string:

 

// this will return eg. 2014
var selectedYear = DROPDOWN_1.getSelectedValue();
if(selectedYear != "--seelct--") {  var eachesArray = ARRAY_1.eaches(1, 52, 1);  eachesArray.forEach(function(element, index) {   var week = "" + (index + 1);      if(week.length < 2) {    week = "0" + week;   }      ARRAY_1.addValue(selectedYear + "." + week);  });  var allValues = ARRAY_1.getValues(";");  TEXT_2.setText(allValues);
} else {  TEXT_2.setText("! select Year!");
}

how to download the Array SDK (and other funny stuff): refer to Karol's SDK Components

 

does this help you?

Regards, Karol


Viewing all articles
Browse latest Browse all 9730


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>