on 10-25-2019 9:00 AM
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
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/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thank you for your answer.
Measure works OK but I cannot make the dimension work.
Regards,
Dimitris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.