Populate a dropdown list including specific dimensions from the data model

var dimensions = Table_1.getDataSource().getDimensions();

// var target_dimensions is an array of dimension id’s that we want to target
var target_dimensions =['Sales_Manager','Store','Product'];
for (var i=0;i<dimensions.length;i++)
         {     if (target_dimensions.includes(dimensions[i].id))     
                /* as the code loops through each dimension from the model, if the dimension is present in the ‘target_dimensions’ variable – then add it to the dropdown */

            {    Dropdown_1.addItem(dimensions[i].id,dimensions[i].description);    } }

Code language: JavaScript (javascript)
Scroll to Top