Skip to Content
avatar image
Former Member

How do I pass the result of one data source to the prompt of another in Design Studio?

I want to pass the department id of the dashboard user to a prompt existing in 5 other data sources. I tried setting up a variable to pass the department id but my code is incorrect. At this point, I am only able to pass a hard-coded department id. What is the code to pass the department id?

//This prompt is in DS_26 and returns the corresponding department id determined by DS_1.getInfo().user.

APPLICATION.setVariableValueExt("psEnter Network ID", DS_1.getInfo().user);

//This prompt is in multiple data sources. I want to pass the department id returned above.

//...Right now I can only pass a hard-coded department id.

APPLICATION.setVariableValueExt("psEnter Evnt Org Level 8 Id", "37620");

//Tried these variables to use instead of the hard-coded department id shown on line 6 above ("37620")

//...but neither work.

//var getDept1 = DS_26.getMembers("OBJ_28", 1);

//var getDept1 = DS_26.getData("OBJ_28", {}).value;

Add comment
10|10000 characters needed characters exceeded

  • Former Member

    Hi Mustafa,

    You are right...the data source is a universe. Here's a screenshot of the initial view. I want to pass the Dept Id returned in this data source to the query prompt of another data source.

    Thanks,

    Meredith

  • Hi Meredith,

    We will need to take a step-by-step approach to get further clarity about the issue. Here are my comments and questions:

    1. Is Dept ID defined as a Dimension or a Measure in the Universe?

    2. In order to confirm that the employee record is being returned as expected based on the logged on user, can you assign DS_26 to a Crosstab and post a screenshot showing the result at run-time?

    Thanks,

    Mustafa.

  • Former Member

    Thanks Mustafa. I was able to pass the variable with the below code.

    var dept = DS_26.getMembers("OBJ_28", 1);

    dept.forEach(function(element, index) {

    APPLICATION.setVariableValueExt("psEnter Evnt Org Level 8 Id", element);

    });

  • Get RSS Feed

1 Answer

  • Best Answer
    Mar 02 at 10:24 AM

    Hi Meredith,

    There is no need to use a for loop. Since you are only returning one member for dimension "OBJ_28", the more efficient code is as follows:

    var dept = DS_26.getMembers("OBJ_28", 1)[0];
    APPLICATION.setVariableValueExt("psEnter Evnt Org Level 8 Id", dept);
    

    Regards,

    Mustafa.

    Add comment
    10|10000 characters needed characters exceeded