0 votes
in SoSci Survey (English) by s182763 (225 points)

Hi All,

In my questionnaire (QN) subjects provide answers early on, and I want them to rate the importance of their answers later in the same QN. I have successfully used DbSet to save the answers, but now I have trouble creating items from these answers.
I have a created a "slider" question in my QN, named "K003". Now I want the items for this Slider question to be generated by the answers given (e.g., "test") from the entries in the database. Is this possible?

btw: The key will have serials attached to them.

Thank you,

1 Answer

+1 vote
by SoSci Survey (306k points)

Now I want the items for this Slider question to be generated by the answers given (e.g., "test") from the entries in the database.

No problem ... what you need is a slider question with placeholders as item texts, and then you will have to run a loop the finds out how many items (and which) to display and that uses replace() to prepare the placeholders.

So the next step is: Do you know which items to display? It it simply the (max.) five items from the columns 0 to 4 in your figure above? In that case, the PHP code might look like this:

$data = dbGet(...);
foreach ($data as $key => $text) {
  if (trim($text) != '') {
    $itemID = $key + 1;
    replace('%item'.$itemID.'%', $text);
  }
}

Self-evident, that the items in the slider (placed below the PHP code) have the item texts %item1% to %item5%.

by s182763 (225 points)
Hi! thank you for your quick reply.
Yes, each K00X represents a day (e.g., Mon-Sunday). For each participant they will have a maximum of 5 days filled out, with max 5 answers per day. Hence, I would need maximum 25 sliders. These don't need to be split by day, unless that would be easy/easier to do.
by s182763 (225 points)
See the closed questions: When I implement the code ....

Willkommen im Online-Support von SoSci Survey.

Hier bekommen Sie schnelle und fundierte Antworten von anderen Projektleitern und direkt von SoSci Survey.

→ Eine Frage stellen


Welcome to the SoSci Survey online support.

Simply ask a question to quickly get answers from other professionals, and directly from SoSci Survey.

→ Ask a Question

...