0 votes
in SoSci Survey (English) by s262917 (125 points)


I am working with an external panel provider and recieved a link set containing a pid and a psid from the survey company.
As complete link, I have to send a multiplication of the pid (this seems to be a security feature)

I've tried to make the calculation based on the help pages on PHP variables but nothing seems to work. I'm including a slightly adapted example of the formula below:


Formula for 'high' parameter value: (54321* PID) - 98765

Thanks for any helpful hints and this fantastic tool!.

P.S.: Some more details on what I've done so far:

Created the variables as post/get variables, following the instructions

added on the first page (consent page):
replace('%ppsid%', 'AD01_RV1', 'response'); // Platzhalter vorbereiten
replace('%ppid%', 'AD01_RV2', 'response'); // Platzhalter vorbereiten

inbetween tried different ways to calculate a new variable highid from ppid that have all led to errors visible to participants

added on the last page:

The PID value contains asterikses - but I don't think this is the problem since i already get errors in debug mode.

1 Answer

0 votes
by SoSci Survey (308k points)
selected by s262917
Best answer

If I understand your code correctly, the PID is stored in AD01_RV2, right? Then start there:

$pid = value('AD01_RV2');
$result = (54321* $pid) - 98765;
replace('%highid%', $result);
by s262917 (125 points)
Thank you very much for the fast reply!
One addition: With this code, I still got an error for multiplying string and int when testing the survey - adding a transformation for the id value seems to solve the problem and stores a value.

$result = (54321* floatval($pid)) - 98765;
by SoSci Survey (308k points)
Well done. As long as the $pid is an integer, you may also write it this way:

$result = 54321 * (int)$pid - 98765;

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