Exiting to a different URL depending upon circumstances

Problem

You want to redirect the respondent to a different URL depending upon circumstances.

Solution

  • calculate a URL based on existing data/responses;
  • recall the calculated URL in the URL pound instruction.

Discussion

If a respondent goes beyond the last question in the questionnaire, the URL pound instruction is used to redirect the browser session to another URL (e.g., a client Web site, a thank-you page, etc.). Only one URL is allowed for each language of the questionnaire.

What if the respondent must be redirected to a different URL based on responses offered in the questionnaire (or prepopulated data)? Calculate a URL into an open-end part and recall it into the URL pound instruction, as in:

    # Url = [EN]{$ACALCURL}[FR]{$ACALCURL}
    CALCURL CALCUL
    % question
       ACALCURL = ( $SOMEANSWER == 1 ) ? "http://somedomain.com/" : "http://someotherdomain.com/"
    % note
    % categories

    % skips
    % condition
    % open
       1 = C50 1 50
    !

Remember that recalls in URL pound instructions must use the Perl recall syntax.

As for the calculation expression above, it uses the Perl condition testing function with a logical expression within the parentheses followed by the result of a "true" condition, a colon and the result for a "false" condition.

Exiting to a different URL depending upon circumstances

Problem

You want to redirect the respondent to a different URL depending upon circumstances.

Solution

  • calculate a URL based on existing data/responses;
  • recall the calculated URL in the URL pound instruction.

Discussion

If a respondent goes beyond the last question in the questionnaire, the URL pound instruction is used to redirect the browser session to another URL (e.g., a client Web site, a thank-you page, etc.). Only one URL is allowed for each language of the questionnaire.

What if the respondent must be redirected to a different URL based on responses offered in the questionnaire (or prepopulated data)? Calculate a URL into an open-end part and recall it into the URL pound instruction, as in:

    # Url = [EN]{$ACALCURL}[FR]{$ACALCURL}
    CALCURL CALCUL
    % question
       ACALCURL = ( $SOMEANSWER == 1 ) ? "http://somedomain.com/" : "http://someotherdomain.com/"
    % note
    % categories

    % skips
    % condition
    % open
       1 = C50 1 50
    !

Remember that recalls in URL pound instructions must use the Perl recall syntax.

As for the calculation expression above, it uses the Perl condition testing function with a logical expression within the parentheses followed by the result of a "true" condition, a colon and the result for a "false" condition.