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

Hi all,

I am trying to use the database for contents feature with PHP code so that I can re-implement answers given by participants.
I currently have the following PHP code as a section on the same questionnaire's page as the "free mentions" question:

$mon = array(
  value('CA03x01'),
  value('CA03x02'),
  value('CA03x03'),
  value('CA03x04'),
  value('CA03x05')
);
$key = 'CA03-'.caseSerial();  
dbSet($key, $mon);

When I test this with the test function on the compose questionnaire page, it creates the database, but doesn't save the text that I input. Furthermore, it also does not save a .caseSerial().

What am I doing wrong,

Thank you

2 Answers

+1 vote
by s182763 (225 points)
selected by s182763
 
Best answer

I figured out the problem myself:

> value() mixed value(string variable, [string outputformat])

Note: Only responses given by the participant on an earlier page in
the questionnaire, and already transmitted to the server with “Next”
can be called up.

So the problem is that I had the PHP code on the same page as the item from which the value was pulled! Kinda logical.

–1 vote
by SoSci Survey (330k points)

When you run the interview in the preview, there simply is no SERIAL in the record.

You will only have a SERIAL if you send an invitation email with a personalized link (is that what you're planning for the actual survey?). Or for testing, if you attach something like &s=12345 in the address bar after opening the preview.

by s182763 (225 points)
Hi, thank you for your response, but this does not answer my main question, nor does it fix the problem (I tried it). Do you have any idea why it does not save the answers given in the questionnaire?
by SoSci Survey (330k points)
You won't be able to store anything based on a key that uses caseSerial() unless you have a caseSerial(). Therefore, based on your question, I think this is the first issue you will have to solve.

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

...