cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Lumira Designer getdata() with parameters

0 Kudos

Hi,

I have a function where I pass dimension and measure as strings.

I need to form a getdata() command like:

var datacell = DS_1.getData("SalesAmount", {"Dimension": memberKey});

but the "SalesAmount" and "Dimension" should be parameters.

I did a lot of examples but none worked for me.

Is there a way to make it work?

Regards,

dimitris

Accepted Solutions (1)

Accepted Solutions (1)

reiner_hille-doering
Active Contributor
0 Kudos

Hello Dimitris,

making "SalesAmount" and "memberKey" a variable is simple:

var sa = "SalesAmount";
var mk = "memberKey";
var cell = DS_1.getData(sa, {"Dimension": mk});

However making "Dimension" variable is kind of tricky, as JSON always have constant keys.

For this we added the function Convert.stringToDataSelection(). You can use it to create an empty selection that you extend

var sa = "SalesAmount";
var mk = "memberKey";
var dimKey = "Dimension";
var selection = Convert.stringToDataSelection();
selection[dimKey] = mk;
var cell = DS_1.getData(sa, selection);

or you can "parse" a selection string:

var sa = "SalesAmount";
var mk = "memberKey";
var dimKey = "Dimension";
var selectionString = '{"' + dimKey +'": "' + mk + ' "}'
var selection = Convert.stringToDataSelection(selectionString);
var cell = DS_1.getData(sa, selection);

Some other example is here:

https://blogs.sap.com/2017/12/21/mysterious-memberlists-in-lumira-designer/

Answers (1)

Answers (1)

0 Kudos

Hi,

Thank you for your answer.

Measure works OK but I cannot make the dimension work.

Regards,

Dimitris