Skip to Content
0

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

Feb 21 at 08:59 PM

76

avatar image
Former Member

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;

10 |10000 characters needed characters left characters exceeded

Hi Meredith,

For clarification, can you:

1) Confirm what type of data source you are using? Based on the variable names I'm guessing it is a Universe, is that right?

2) Post a screenshot of the data source initial view showing the data preview.

Thanks,

Mustafa.

0
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

0

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.

0
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);

});

0
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Mustafa Bensan Mar 02 at 10:24 AM
0

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.

Share
10 |10000 characters needed characters left characters exceeded