Skip to Content

SAP Lumira Designer getdata() with parameters

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Oct 25, 2019 at 08:26 AM

    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/

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 25, 2019 at 09:51 AM

    Hi,

    Thank you for your answer.

    Measure works OK but I cannot make the dimension work.

    Regards,

    Dimitris

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.