0 votes
in SoSci Survey (English) by s090694 (110 points)
edited by SoSci Survey

Hello SoSci Survey Team,

We are currently working on a survey that includes 11 scenarios (dilemmas). For each one, an audio file is played first, followed on the next page by several questions, including an attention check (control question).

We’ve programmed this so that, depending on whether the German or English version is randomly selected, different questions are shown. For example, we use code like this directly after each attention check:

if (value('IF05') == 2) {
  $pt1 = 1;
} elseif (value('IF05') == 1) {
  $pt1 = 0;
}
elseif (value('IF16') == 2) {
  $pt1 = 1;
} elseif (value('IF16') == 1) {
  $pt1 = 0;
}

This pattern repeats for all 11 attention checks, with different variables ($pt1-$pt11)
In this setup, 0 means the question was answered correctly, 1 means it was answered incorrectly. The values 1 and 2 correspond to the actual response options.

What we would now like to achieve at the end of the survey is the following:

If a participant answers three or more attention checks incorrectly, they should not be redirected to the Clickworker page that shows the payment code. Instead, they should immediately see a message like this:

    In German: “Leider haben Sie zu viele Kontrollfragen falsch beantwortet und können die Studie nicht abschließen.”

    In English: “Unfortunately, you answered too many attention checks incorrectly and cannot complete the study.”
    Afterwards, the survey should simply end.

Participants who answered fewer than three attention checks incorrectly should proceed as normal to the Clickworker page, where they receive their code, and then to the final page that contains our closing text.

We have tried several approaches to achieve this, for example summing up and redirecting with goToPage(). Unfortunately, none of these solutions has worked reliably. In some cases we received errors such as “Undefined variable”, and in others participants were incorrectly redirected to the end page even when all attention checks were answered correctly.

We would greatly appreciate your support in finding a stable solution for SoSci Survey. Specifically, we’d like your advice on how best to count the number of incorrectly answered attention checks and then reliably decide whether to redirect the participant to the Clickworker page or terminate the survey with the appropriate message.

Thank you very much in advance for your help!

Best regards,

1 Answer

0 votes
by SoSci Survey (352k points)

I understand that some of the trouble arises from using different question in the two conditions. And I assume that the condition is the same throughout the questionnaire?

My recommendation would be to use a filter and calculate the errors based on the correct questions, for example:

if (condition1) {
  $errors = (value('IF05') == 2) + (value('IF06') == 1) + (value('IF07') == 2);
} else {
  $errors = (value('IF16') == 2) + (value('IF17') == 3) + (value('IF18') == 2);
}

As soon as you have to correct number, you can take care of the screenout.

if ($errors >= 3) {
  text('TX01');  // Display the text
}

And on the next page

if ($errors >= 3) {
  redirect(...);
}

Other options would include to store the errors in internal variables.

by s090694 (110 points)
I now have added these codes:
if (value('ZG01') == 1 || value('ZG01') == 2) {
  $errors =
    (value('IF05') == 2) +
    (value('IF10') == 2) +
    (value('IF02') == 2) +
    (value('IF09') == 1) +
    (value('IF01') == 2) +
    (value('IF03') == 1) +
    (value('IF04') == 1) +
    (value('IF11') == 1) +
    (value('IF07') == 1) +
    (value('IF06') == 2) +
    (value('IF08') == 1);
} else {
  $errors =
    (value('IF16') == 2) +
    (value('IF21') == 2) +
    (value('IF13') == 2) +
    (value('IF20') == 1) +
    (value('IF12') == 2) +
    (value('IF14') == 1) +
    (value('IF15') == 1) +
    (value('IF22') == 1) +
    (value('IF18') == 1) +
    (value('IF17') == 2) +
    (value('IF19') == 1);
}

put('IV01_01', $errors);

if ($errors >= 3) {
  if (value('ZG01') == 1 || value('ZG01') == 2) {
    text('AC01');
  } else {
    text('AC02');
  }
}  
and then this code on the next page right before the clickworker code:
if (value('IV01_01') >= 3) {
  goToPage('end');
}

I have stored the error as internal variable (IV01_01)

We have 4 surveys, they are the same but have a different order of the audios and questions. The weird thing is that the codes work in the first survey. When I answer all attention check questions correctly (less than three wrong), I get the Clickworker code. When I answer more than three questions wrong, I get a text the text that informs me I have not answered enough questions correctly and I am redirected to the last page without receiving a clickworker code. However, in surveys 2,3 and 4, when I answer the questions correctly, everything works but when I answer more than three incorrectly, I get a Questionnaire error, but weirdly on the page before I have added the code I added in the beginning and it says:
There is an error in the PHP code:

Questionnaire Error: Undefined variable $pt1
line: 3

PHP code

001 namespace s2survey\questionnaire\environment;
002
003 if ($pt1 + $pt2 + $pt3 + $pt4 + $pt5 + $pt6 + $pt7 + $pt8 + $pt9 + $pt10 + $pt11 > 3) {
004     if (value('ZG01') == 1) {
005         text('Leider haben Sie zu viele Kontrollfragen falsch beantwortet und können die Studie nicht abschließen.');
006     } elseif (value('ZG01') == 2) {

Questionnaire Error: Undefined variable $pt2
line: 3

PHP code

001 namespace s2survey\questionnaire\environment;
002
003 if ($pt1 + $pt2 + $pt3 + $pt4 + $pt5 + $pt6 + $pt7 + $pt8 + $pt9 + $pt10 + $pt11 > 3) {
004     if (value('ZG01') == 1) {
005         text('Leider haben Sie zu viele Kontrollfragen falsch beantwortet und können die Studie nicht abschließen.');
006     } elseif (value('ZG01') == 2) {

Questionnaire Error: Undefined variable $pt3
line: 3

PHP code

001 namespace s2survey\questionnaire\environment;
002
003 if ($pt1 + $pt2 + $pt3 + $pt4 + $pt5 + $pt6 + $pt7 + $pt8 + $pt9 + $pt10 + $pt11 > 3) {
004     if (value('ZG01') == 1) {
005         text('Leider haben Sie zu viele Kontrollfragen falsch beantwortet und können die Studie nicht abschließen.');
006     } elseif (value('ZG01') == 2) {

Questionnaire Error: Undefined variable $pt4
line: 3

PHP code

001 namespace s2survey\questionnaire\environment;
002
003 if ($pt1 + $pt2 + $pt3 + $pt4 + $pt5 + $pt6 + $pt7 + $pt8 + $pt9 + $pt10 + $pt11 > 3) {
004     if (value('ZG01') == 1) {
005         text('Leider haben Sie zu viele Kontrollfragen falsch beantwortet und können die Studie nicht abschließen.');
006     } elseif (value('ZG01') == 2) {

Questionnaire Error: Undefined variable $pt5
line: 3

PHP code

001 namespace s2survey\questionnaire\environment;
002
003 if ($pt1 + $pt2 + $pt3 + $pt4 + $pt5 + $pt6 + $pt7 + $pt8 + $pt9 + $pt10 + $pt11 > 3) {
004     if (value('ZG01') == 1) {
005         text('Leider haben Sie zu viele Kontrollfragen falsch beantwortet und können die Studie nicht abschließen.');
006     } elseif (value('ZG01') == 2) {

Questionnaire Error: Undefined variable $pt6
line: 3

PHP code

001 namespace s2survey\questionnaire\environment;
002
003 if ($pt1 + $pt2 + $pt3 + $pt4 + $pt5 + $pt6 + $pt7 + $pt8 + $pt9 + $pt10 + $pt11 > 3) {
004     if (value('ZG01') == 1) {
005         text('Leider haben Sie zu viele Kontrollfragen falsch beantwortet und können die Studie nicht abschließen.');
006     } elseif (value('ZG01') == 2) {

Questionnaire Error: Undefined variable $pt7
line: 3

PHP code

001 namespace s2survey\questionnaire\environment;
002
003 if ($pt1 + $pt2 + $pt3 + $pt4 + $pt5 + $pt6 + $pt7 + $pt8 + $pt9 + $pt10 + $pt11 > 3) {
004     if (value('ZG01') == 1) {
005         text('Leider haben Sie zu viele Kontrollfragen falsch beantwortet und können die Studie nicht abschließen.');
006     } elseif (value('ZG01') == 2) {

Questionnaire Error: Undefined variable $pt8
line: 3

PHP code

001 namespace s2survey\questionnaire\environment;
002
003 if ($pt1 + $pt2 + $pt3 + $pt4 + $pt5 + $pt6 + $pt7 + $pt8 + $pt9 + $pt10 + $pt11 > 3) {
004     if (value('ZG01') == 1) {
005         text('Leider haben Sie zu viele Kontrollfragen falsch beantwortet und können die Studie nicht abschließen.');
006     } elseif (value('ZG01') == 2) {

Questionnaire Error: Undefined variable $pt9
line: 3

PHP code

001 namespace s2survey\questionnaire\environment;
002
003 if ($pt1 + $pt2 + $pt3 + $pt4 + $pt5 + $pt6 + $pt7 + $pt8 + $pt9 + $pt10 + $pt11 > 3) {
004     if (value('ZG01') == 1) {
005         text('Leider haben Sie zu viele Kontrollfragen falsch beantwortet und können die Studie nicht abschließen.');
006     } elseif (value('ZG01') == 2) {

Questionnaire Error: Undefined variable $pt10
line: 3

PHP code

001 namespace s2survey\questionnaire\environment;
002
003 if ($pt1 + $pt2 + $pt3 + $pt4 + $pt5 + $pt6 + $pt7 + $pt8 + $pt9 + $pt10 + $pt11 > 3) {
004     if (value('ZG01') == 1) {
005         text('Leider haben Sie zu viele Kontrollfragen falsch beantwortet und können die Studie nicht abschließen.');
006     } elseif (value('ZG01') == 2) {

Questionnaire Error: Undefined variable $pt11
line: 3

PHP code

001 namespace s2survey\questionnaire\environment;
002
003 if ($pt1 + $pt2 + $pt3 + $pt4 + $pt5 + $pt6 + $pt7 + $pt8 + $pt9 + $pt10 + $pt11 > 3) {
004     if (value('ZG01') == 1) {
005         text('Leider haben Sie zu viele Kontrollfragen falsch beantwortet und können die Studie nicht abschließen.');
006     } elseif (value('ZG01') == 2) {

Questionnaire Error: Undefined variable $pt1
line: 13

PHP code

010     } elseif (value('ZG01') == 4) {
011         text('Unfortunately, you answered too many attention checks incorrectly and cannot complete the study.');
012     }
013 } elseif ($pt1 + $pt2 + $pt3 + $pt4 + $pt5 + $pt6 + $pt7 + $pt8 + $pt9 + $pt10 + $pt11 <= 3) {
014     return 'go:end';
015 }
016 return 'ok';

Questionnaire Error: Undefined variable $pt2
line: 13

PHP code

010     } elseif (value('ZG01') == 4) {
011         text('Unfortunately, you answered too many attention checks incorrectly and cannot complete the study.');
012     }
013 } elseif ($pt1 + $pt2 + $pt3 + $pt4 + $pt5 + $pt6 + $pt7 + $pt8 + $pt9 + $pt10 + $pt11 <= 3) {
014     return 'go:end';
015 }
016 return 'ok';

Questionnaire Error: Undefined variable $pt3
line: 13

PHP code

010     } elseif (value('ZG01') == 4) {
011         text('Unfortunately, you answered too many attention checks incorrectly and cannot complete the study.');
012     }
013 } elseif ($pt1 + $pt2 + $pt3 + $pt4 + $pt5 + $pt6 + $pt7 + $pt8 + $pt9 + $pt10 + $pt11 <= 3) {
014     return 'go:end';
015 }
016 return 'ok';

Questionnaire Error: Undefined variable $pt4
line: 13

PHP code

010     } elseif (value('ZG01') == 4) {
011         text('Unfortunately, you answered too many attention checks incorrectly and cannot complete the study.');
012     }
013 } elseif ($pt1 + $pt2 + $pt3 + $pt4 + $pt5 + $pt6 + $pt7 + $pt8 + $pt9 + $pt10 + $pt11 <= 3) {
014     return 'go:end';
015 }
016 return 'ok';

Questionnaire Error: Undefined variable $pt5
line: 13

PHP code

010     } elseif (value('ZG01') == 4) {
011         text('Unfortunately, you answered too many attention checks incorrectly and cannot complete the study.');
012     }
013 } elseif ($pt1 + $pt2 + $pt3 + $pt4 + $pt5 + $pt6 + $pt7 + $pt8 + $pt9 + $pt10 + $pt11 <= 3) {
014     return 'go:end';
015 }
016 return 'ok';

Questionnaire Error: Undefined variable $pt6
line: 13

PHP code

010     } elseif (value('ZG01') == 4) {
011         text('Unfortunately, you answered too many attention checks incorrectly and cannot complete the study.');
012     }
013 } elseif ($pt1 + $pt2 + $pt3 + $pt4 + $pt5 + $pt6 + $pt7 + $pt8 + $pt9 + $pt10 + $pt11 <= 3) {
014     return 'go:end';
015 }
016 return 'ok';

Questionnaire Error: Undefined variable $pt7
line: 13

PHP code

010     } elseif (value('ZG01') == 4) {
011         text('Unfortunately, you answered too many attention checks incorrectly and cannot complete the study.');
012     }
013 } elseif ($pt1 + $pt2 + $pt3 + $pt4 + $pt5 + $pt6 + $pt7 + $pt8 + $pt9 + $pt10 + $pt11 <= 3) {
014     return 'go:end';
015 }
016 return 'ok';

Questionnaire Error: Undefined variable $pt8
line: 13

PHP code

010     } elseif (value('ZG01') == 4) {
011         text('Unfortunately, you answered too many attention checks incorrectly and cannot complete the study.');
012     }
013 } elseif ($pt1 + $pt2 + $pt3 + $pt4 + $pt5 + $pt6 + $pt7 + $pt8 + $pt9 + $pt10 + $pt11 <= 3) {
014     return 'go:end';
015 }
016 return 'ok';

Questionnaire Error: Undefined variable $pt9
line: 13

PHP code

010     } elseif (value('ZG01') == 4) {
011         text('Unfortunately, you answered too many attention checks incorrectly and cannot complete the study.');
012     }
013 } elseif ($pt1 + $pt2 + $pt3 + $pt4 + $pt5 + $pt6 + $pt7 + $pt8 + $pt9 + $pt10 + $pt11 <= 3) {
014     return 'go:end';
015 }
016 return 'ok';

Questionnaire Error: Undefined variable $pt10
line: 13

PHP code

010     } elseif (value('ZG01') == 4) {
011         text('Unfortunately, you answered too many attention checks incorrectly and cannot complete the study.');
012     }
013 } elseif ($pt1 + $pt2 + $pt3 + $pt4 + $pt5 + $pt6 + $pt7 + $pt8 + $pt9 + $pt10 + $pt11 <= 3) {
014     return 'go:end';
015 }
016 return 'ok';

Questionnaire Error: Undefined variable $pt11
line: 13

PHP code

010     } elseif (value('ZG01') == 4) {
011         text('Unfortunately, you answered too many attention checks incorrectly and cannot complete the study.');
012     }
013 } elseif ($pt1 + $pt2 + $pt3 + $pt4 + $pt5 + $pt6 + $pt7 + $pt8 + $pt9 + $pt10 + $pt11 <= 3) {
014     return 'go:end';
015 }
016 return 'ok';

What is the mistake here?

Thank you so much in advance!
by SoSci Survey (352k points)
> Questionnaire Error: Undefined variable $pt1

Obviously from the error messages, you use a different code than above. The problem seems to be that the PHP variable $pt1 (and maybe not the others as well) are not defined in the respective PHP code block.
by s090694 (110 points)
But exactly that is the weird thing, I have not used a different code than above, I deleted the former codes that we used and pasted the exact same codes from the first questionnaire.
by SoSci Survey (352k points)
> I have not used a different code than above,

Okay, then please check "Compose Questionnaire" -> "Manage Questionnaires" if you have more than one questionnaire in the project? And please also check the tabs "PHP Functions" and "Internal Code" for $pt1.
by s090694 (110 points)
okay thank you everything works now but I have one last question. We want to connect the survey with clickworker. So far, we have the page for the attention checks with this code:
if (value('ZG01') == 1 || value('ZG01') == 2) {
  $errors =
    (value('IF05') == 2) +
    (value('IF10') == 2) +
    (value('IF02') == 2) +
    (value('IF09') == 1) +
    (value('IF01') == 2) +
    (value('IF03') == 1) +
    (value('IF04') == 1) +
    (value('IF11') == 1) +
    (value('IF07') == 1) +
    (value('IF06') == 2) +
    (value('IF08') == 1);
} else {
  $errors =
    (value('IF16') == 2) +
    (value('IF21') == 2) +
    (value('IF13') == 2) +
    (value('IF20') == 1) +
    (value('IF12') == 2) +
    (value('IF14') == 1) +
    (value('IF15') == 1) +
    (value('IF22') == 1) +
    (value('IF18') == 1) +
    (value('IF17') == 2) +
    (value('IF19') == 1);
}

put('IV01_01', $errors);

if ($errors >= 3) {
  if (value('ZG01') == 1 || value('ZG01') == 2) {
    text('AC01');
  } else {
    text('AC02');
  }
}
 On the next page we have this first code:
if (value('IV01_01') >= 3) {
  goToPage('end');
}
and then the second code that is for clickworker:
// compose database key
$key = 'cw'.reference();
// read out row
$entry = dbGet($key);
// Extract code from the line if the line was found
if ($entry) {
    $code = $entry[2];
} else {
    $code = 'FAIL:'.reference();
}
// display in the questionnaire
html('<p>Your confirmation code is <strong>'.$code.'</strong>.</p>');


This means that people who have answered three or more attention checks question wrong are automatically redirected towards the last page. Does this truly ensure that only people who have answered two or less attention check questions wrong get their clickworker code? I am afraid that clickworker will still show a page with a clickworker code to the participants who have failed the attention checks and were immediately redirected to the end page. Or is this impossible with the codes that we have now generated?
by SoSci Survey (352k points)
>  I am afraid that clickworker will still show a page with a clickworker code to the participants

Well, I see no possibility to get an $error variable with <3 without answering the attention checks correctly.

So, the goToPage() filter will realiably work. You can set another control variable to store the clickworker code in the dataset, if it is shown:

html('<p>Your confirmation code is <strong>'.$code.'</strong>.</p>');
put('IV01_02', $code).

Then you can check if everything is working fine.
by s090694 (110 points)
Thank you for your help. However, another problem has appeared. When we placed the order in clickworker, we got an email saying:

Hello,

Unfortunately, we have received reports from users stating that the codes displayed at the end of the survey cannot be redeemed. I have checked myself, and at least in my own link, the displayed code did not match the one from the uploaded file. This is consistent with the fact that there has only been one successful participation so far. I have therefore paused the project for now.

Since it appears that almost all links are affected, the most sensible solution would be to end the current project prematurely, clone it, and then upload a new file with links and codes that correctly match.

We are currently collecting reports from participants who were unable to redeem their payment. As you have already received the data from these participants and likely have more than just one completed response, we would bill you for these completed participations afterward.


This is really weird as all of the codes match and the excel file that I uploaded to clickworker, matches the file in soscisurvey. How can it be that a code was shown that is not in the file?

I will give you all the codes that we had in the end, maybe there is another mistake:
This is the attention check code:
if (value('ZG01') == 1 || value('ZG01') == 2) {
  $errors =
    (value('IF05') == 2) +
    (value('IF10') == 2) +
    (value('IF02') == 2) +
    (value('IF09') == 1) +
    (value('IF01') == 2) +
    (value('IF03') == 1) +
    (value('IF04') == 1) +
    (value('IF11') == 1) +
    (value('IF07') == 1) +
    (value('IF06') == 2) +
    (value('IF08') == 1);
} else {
  $errors =
    (value('IF16') == 2) +
    (value('IF21') == 2) +
    (value('IF13') == 2) +
    (value('IF20') == 1) +
    (value('IF12') == 2) +
    (value('IF14') == 1) +
    (value('IF15') == 1) +
    (value('IF22') == 1) +
    (value('IF18') == 1) +
    (value('IF17') == 2) +
    (value('IF19') == 1);
}

put('IV01_01', $errors);

if ($errors >= 3) {
  if (value('ZG01') == 1 || value('ZG01') == 2) {
    text('AC01');
  } else {
    text('AC02');
  }
}



A page later we have two codes:
First:
if (value('IV01_01') >= 3) {
  goToPage('end');
}

Second:
// compose database key
$key = 'cw'.reference();
// read out row
$entry = dbGet($key);
// Extract code from the line if the line was found
if ($entry) {
    $code = $entry[2];
} else {
    $code = 'FAIL:'.reference();
}
// display in the questionnaire
html('<p>Your confirmation code is <strong>'.$code.'</strong>.</p>');
// Store the code in internal variable IV01_02 (e.g. clickworker_code)
put('IV01_02', $code);

The page after is the last page that says "Thank you". What problem could there be that caused this issue?
by SoSci Survey (352k points)
edited by SoSci Survey
> This is really weird as all of the codes match and the excel file that I uploaded to clickworker

I do not think, this has enything to do with your PHP code. Your code only decides whether to display a code or not.

Please check the dataset, variable IV0102 - this is the code that ist displayed by your code - and check it against the table that Clickworker refers to.
by s090694 (110 points)
I checked again, and the tabel uplaoded on clickworker is the exact same that is on SosciSurvey, and the people who did the survey got the matching codes, so I am not sure what else could be the issue. Could it be this: I started by generating the codes and then I made the excel sheet and uploaded it in Database for Contents. Now ChatGPT says that I then should have deleted the initial codes that I generated in Access Codes because apparently thats what might cause the issues. On the manual that I followed from your website it said: "Note: You do not have to create the random codes in SoSci Survey and you can also delete the participation codes in SoSci Survey once the table has been created if you wish." Might this be the problem?
by SoSci Survey (352k points)
> the people who did the survey got the matching codes, so I am not sure what else could be the issue

So, you tell it works in each of your tests, but not when clickworker sends the links to their workers?

> Now ChatGPT says that I then should have deleted the initial codes that I generated in Access Codes

ChatGPT has absolutely no idea about SoSci SUrvey and is simply hallucinating. Don't ask it for things that need thinking.

Deleting or not deleting the original access codes has no effect on your problem.

What you need to check is this: Do REF and IV01_02 match? In your dataset that you have collected.

And if they match, then ask clickworker for a link (REF) they sent out and what code they would have expected and what code they received.
by s090694 (110 points)
edited by s090694
So I checked the REF and the IV01_02. We had 200 codes, so 200 links and 200 REFs. Weirdly the REFs and the IV01_02 match, however it also displays REFs from 200 to 321 and the IV01_02 obviously do not match because the codes don't exist as I only generated 200 codes. What is displayed in the IV01_02 column there is a code that says: FAIL: and then the number of the REF so for example: REF 321 and then the IV01_02 variable is FAIL:321. But there shouldn't be a code or a REF for 321 in the first place. What could be the issue? What is also weird is that I asked clickworker to send me a list with the codes and the IDs that were used and apparently didn't work. The codes match the links and the keys perfectly. However, when I compare that list to the excel table dataset I just downloaded from SosciSurvey, those REFs/IDs and IV01_02 variables are not listed there.
by s090694 (110 points)
I checked the table from Clickworker, as well, so where all participants are listed who did the survey and whose code apparently doesn't work. Everything matches the original codes and table that I made in the very beginning. Only one participant's code worked.
by SoSci Survey (352k points)
The REFs match the codes in both lists?

> Weirdly the REFs and the IV01_02 match, however it also displays REFs from 200 to 321 and the IV01_02 obviously do not match because the codes don't exist as I only generated 200 codes.

One might have tried to guess REFs and earn more money. If I had created an AI to work through questionnaires, this is what I would try.

> I asked clickworker to send me a list with the codes and the IDs that were used and apparently didn't work

Could it be that someone was faster in trying the numbers 1 to 200, and then already send the code to Lcickworker? Do you have duplicate entries for these REFs in your dataset?

> The codes match the links and the keys perfectly.

Okay, if they match, then tell Clickworker that they matched and ask them why they did not accept the codes? maybe someone messed up some table at some point.

> those REFs/IDs and IV01_02 variables are not listed there.

The variables or the codes?
by s090694 (110 points)
>The variables or the codes?

Both are not in there at all.

However, one clickworker worker juts tried on link again and he said that he should have gotten the variable KG344823 as listed in the file, but he got the code FAIL:323.

>One might have tried to guess REFs and earn more money. If I had created an AI to work through questionnaires, this is what I would try.

But even then, they would get a fail code because those links don't exist. Codes 1-200 should still work.

Is there an email where I can send the excel files and results? Maybe it is easier to understand the issue then.
by SoSci Survey (352k points)
> Both are not in there at all.

Okay, then something during data export/import probably went wrong. Please check "Collected Data" -> "View Data". You should at least find the REF variable, there.

> he got the code FAIL:323

That means that the link probably contained a r=323, which should not be possible (if I understand you correctly). Please ask Clickworker for the link that was used.
by s090694 (110 points)
>That means that the link probably contained a r=323, which should not be possible (if I understand you correctly). Please ask Clickworker for the link that was used.

He actually used this link: https://www.soscisurvey.de/foreignlanguage_german_na485897/?r=69
by s090694 (110 points)
>Okay, then something during data export/import probably went wrong. Please check "Collected Data" -> "View Data". You should at least find the REF variable, there.

Do you me "View Data Set"?
by SoSci Survey (352k points)
> He actually used this link

If using this link (you can give it a try) the REF should be 69, not 323. Unless you use put('REF', ...) somewhere in your code, this won't change.

> Do you me "View Data Set"?

Yes, that is the correct label.
by s090694 (110 points)
Well, he used the link with r=69 and got the code FAIL:323. What does this mean, I mean what would be the mistake if something like this happened?
by SoSci Survey (352k points)
Are you able to replicate the situation, that is, if you use that link an click through the questionnaire, (a) what code is displayed and (b) what REF is stored in the dataset?
by s090694 (110 points)
Yes I used the exact same link and I got the code FAIL:328, and then in the View Data Set it looks really weird.The REF is 69 and next to it it says randomorder (that is the main questionnaire that we used and that gives participants one of the four surveys we made. than in the line above it says in serial: CASE000328     and the REF is 328 and the questionaaire then is base03 so the third survey. Same thing for the time the clickworker worker used the link. it says REF 69 and then above REF 323
by SoSci Survey (352k points)
>  it it says randomorder

You're working with goToQuestionnaire(), right?

Please read the advice in https://www.soscisurvey.de/help/doku.php/en:create:random_questionnaire#interaction_with_extern_panels, switch to multiLevelDown() and take care of using the proper variable.
by s090694 (110 points)
okay I changed the first code to : $qnr = value('ZG02', 'label');
multiLevelDown($qnr, reference());

and then the codes in the four surveys to:
$key = 'cw' . multiLevelData();
$entry = dbGet($key);

if ($entry) {
    $code = $entry[2];
} else {
    $code = 'FAIL:' . multiLevelData();
}

html('<p>Your confirmation code is <strong>' . $code . '</strong>.</p>');

// Speichern in Datensatz
put('IV01_01', multiLevelData());  // REF
put('IV01_02', $code);


I tried multiple links and now the correct codes are appearing. I just wanted to ask if everything is correct now and if we can place another order in clickworker without any bad surprises? Thank you for your help in advance.
by SoSci Survey (352k points)
> I just wanted to ask if everything is correct

Unfortunately, I do not have the ability of magically seeing if a code will work under any circumstances. But it look better, and if you see the code working, that's quite a good indicator that the specific issue has been solved.

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

...