Setting Embedded Data Valued from External Source (e.g. .csv file or any form of DB) | XM Community
Skip to main content

Hi, I am new to Qualtrics and really can't get past this.
In my Survey, I ask participants to solve some problems, where the parameters of the problems change across questions. For convenience, let's call the set of parameters that define a specific question/problem criterium. Hence, a specific question is identified with its crtierium.
Assume that I have Database (.e.g. csv file) with two columns: a criterium and values of interest.
For each criterium there are multiple possible values.
The problem is the following: everytime a question corresponding to a given criterium is asked (I randomize them) I would like to draw all the possible corresponding values (the one that have that criterium) from the Database and then pick a random value among them. Once the value is picked it would be used within the block where that questions belongs.
As far as I understood, if I was able to put them into an array in JavaScript, then randomizing among the values would be easy.
Then I guess the problem boils down to: is it possible to import values from an external data source, draw them according to some criterium and then put them as embedded data to be used within questions?

Sorry for the long questions, I really appreciate your help!

Andrea

You can use a web service to pull in values from an external source and populate embedded data variables. See: https://www.qualtrics.com/support/survey-platform/survey-module/survey-flow/advanced-elements/web-service/


Thank you very much for your answer TomG!
However, I have 2 issues relating to it:
1) I am definetely not an expert in this field, but I assume that to call an external web service, through an URL, I have to set up some kind of server to host the information that I wish to call. I am not sure that I would be able to do this. Of course if that is not the case I would be very grateful if you could help me in understanding how.
2) Given that I want to randomize them, my idea was to assign the values to a JS array first, do the ranodmization procedure within a JS and then assign that sepcific value to an embedded data field. Moreover, for some criteria, the number of values to fetch may be very high, which would imply creating a very high number of embedded data field in the survey flow. Hence, is it possible to call external information from within a JS, to be assigned to embedded data only afterwards?

Thanks again for you help.

Andrea


1) I am definetely not an expert in this field, but I assume that to call an external web service, through an URL, I have to set up some kind of server to host the information that I wish to call. I am not sure that I would be able to do this. Of course if that is not the case I would be very grateful if you could help me in understanding how.

Yes, the web service script would have to be hosted on a web server. A simple hosting service would most likely suffice.
2) Given that I want to randomize them, my idea was to assign the values to a JS array first, do the ranodmization procedure within a JS and then assign that sepcific value to an embedded data field. Moreover, for some criteria, the number of values to fetch may be very high, which would imply creating a very high number of embedded data field in the survey flow. Hence, is it possible to call external information from within a JS, to be assigned to embedded data only afterwards?

You could do the randomization and assignment of a specific value within the web service script and just return the value of one embedded data field.


Yes, the web service script would have to be hosted on a web server. A simple hosting service would most likely suffice.

I am afraid that my limited understanding ends here.
Correct me please: I would have to use an hosting service, which would provide me with a domain and a "place" where to host the database. On that domain, I would put a script that, when the web service is called from Qualtrics, takes the criterium as an input and outputs the value, randomly drawn from the set of values corresponding to that criterium.
If my interpretation is correct, as I have no experience in web services, which programming language would be required to do something like this?


Yes, you've got it correct. You could write the script in PHP or Python. I will add that the values could be drawn from a database such as MySQL.


Thanks again TomG , this was very helpful!


Leave a Reply