cancel
Showing results for 
Search instead for 
Did you mean: 

Add Measure in DEsign studio using script

former_member193552
Participant
0 Kudos

Can i add measures in my document just like i add dimensions using Script.   I am not asking for initial view, i am referring to script where i could dynamically add any measure if i want to add or replace any measure using script.

Thanks

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

If you want to add a measures in your crosstab, you can use this :

DS_1.setFilter("Measures", "Technical name of your measure")

Regards,

Jonas.

Former Member
0 Kudos

Hello Faisal,

If you mean creating new key figures either in the datasource or for a crosstab / chart, no. Not yet.

But what you can do is read the data from a datasource, calculate something and put it into texts.

It's not the best way, but it works, especially for KPIs.

Former Member
0 Kudos

Hello,

I have the same need and issue.

From what I have found it does not seem to be supported. Even the filter components do not show available values/dimensions/measures. I hope SAP will support this soon!

Former Member
0 Kudos

Hi Aharon,

If your need is to add or remove measure via script, it can be realized by setFilter method.

The idea behind is that [Measure] is a special dimension whose members are those measures.

So for example, DS_1.setFilterExt("[Measures]", "REVENUE;COST;PROFIT;");

Best regards,

Alfred

Former Member
0 Kudos

Alfred,

That did not work for me.

//clear dropdown filter

TILE_1_DROPDOWN.removeAllItems();

//filter to available items for tile

KPI_FILTERS.setFilterExt("tileOrderField",selectTile);

//populate

TILE_1_DROPDOWN.setItems(KPI_FILTERS.getMemberList

("filterField", MemberPresentation.INTERNAL_KEY ,MemberDisplay.TEXT, 100));

My issue here is that every time I tell it to getMemberList it looks at the entire dataset not the filtered dataset.

Former Member
0 Kudos

Hi Aharon,

Actually I am not sure what your question is. From your script, it seems to me the use case is different from the original post while my script is for the original question.

If you are seeking to have cascading filter, then you can set "Members for filtering" to "Only Values with posted data" in the Initial View.


I suggest you to open another thread if your need is not exactly the same as the original one.


Best regards,

Alfred

Former Member
0 Kudos

Hi Faisal,

You could also look at using an Analysis for Office View as a datasource.  In the view you can add custom calculations and then set the hide / display properties in Design Studio.

hai_murali_here
Advisor
Advisor
0 Kudos

Hi Faisal,

If you want to add list of measures say in Dropdown box,you can do this as follows.

DROPDOWN_1.setItems(DS_1.getMemberList(

"[Measures]", MemberPresentation.INTERNAL_KEY, MemberDisplay.TEXT, 10));

Rgds,Murali

Former Member
0 Kudos

Hi Muralikrishnan,

I tried the code you wrote but it didn't work. This is the code I wrote:

DROPDOWN_2.setItems(DS_1.getMemberList("[Measures]", MemberPresentation.INTERNAL_KEY, MemberDisplay.TEXT, 200));

Do you have any idea? I'd like to modify that code so I can get a list of dimension in a drop down. Is it possible?

Regards,

Marcello

hai_murali_here
Advisor
Advisor
0 Kudos

Hi,

For setting Dimension in drop down,you can use

DROPDOWN_SOLDTO.setItems( DS_1.getMemberList(

"0D_SOLD_TO", MemberPresentation.INTERNAL_KEY, MemberDisplay.TEXT, 20,"ALL"));

wherein 0D_SOLD_TO is a dimension.

Rgds,Murali

Former Member
0 Kudos

I'd like to have in a drop down  the list of all the avaiable dimensions , instead of the list of all members in a dimension.

Do you think it is possible?

Regards,

Marcello

hai_murali_here
Advisor
Advisor
0 Kudos

Hi Marcello,

I dont think this is supported,but you can use "Filter Panel" component to list all the dimensions of datasource.

You can place a button and clicking on that shows this "Filter Panel" as a pop up and let the user to select the values for the interested dimension.

Rgds,

Murali

Former Member
0 Kudos

I was thinking about using filter panel but you had a great idea.

Thanks a lot

Regards

Marcello

Former Member
0 Kudos

You can do it, but the filter panel or the navigation area is here to take care of it.

OnStartup:


var arrayDims = DS_1.getDimensions();

arrayDims.forEach(function(element, index) {

  if (!element.isMeasuresDimension) {

  LISTBOX_1.addItem(element.name, element.name);

  }

});

Initial View:

See, only 0D_NW_BP and some measures are used.

Application and the Dropdown contains all of the available dimensions: