homefeaturesexamplesDOCUMENTATIONblogpricingcontact us
technical documentationCATI documentationcookbookrobot

Closing access once a certain number of completed questionnaires is reached


You want to disallow access to a questionnaire once a certain number of questionnaires have been completed.


There are two solutions to this problem:

  • use a QUOTA question;
  • use a "Deny access if" pound instruction.


The purpose of a QUOTA question is to flow questionnaires to an alternate route (typically to a "Thanks anyway" page) once a certain number of questionnaires have been completed in a certain group (or in the entire field work). The syntax of QUOTA questions is fully explained in the CallWeb documentation. The key advantage of QUOTA questions compared to the second solution proposed below is that they are easily sensitive to complex situations and they are resource-efficient in that they are only tested when they are reached.

The second solution is to add a "Deny access if" pound instruction which returns "true" once a certain number of completed questionnaires are found in the data base. The syntax of this instruction could be as follows:

    # Deny access if = {_nrecords_mysql("project_name","WHERE QEND=1")>=300}

In this example, access to the questionnaire is denied when 300 cases have "QEND=1" in the data base of project "project_name". Of course, the WHERE clause could contain any legitimate MySQL expression based on the questions in the questionnaire. Note also that the expression is within braces since it is evaluated as a Perl expression. The main advantage of this solution is that it can block the project at any time while filling out the questionnaire since "Deny access if" is tested upon each call to callweb.cgi (hence the threshhold stated will not be exceeded); this is also the key weakness of this solution: the test (and the call to MySQL to count completed cases) is implemented often and could become a burden on the system if numbers grow very high. This instruction displays system message 28 which is fully customizable, like any other system message.


e-mail technical support!