OnViewQuestionnaire is a special global function. It is called during a data entry application when a user attempts to open the
questionnaire view from the menu (
View > Questionnaire). This function allows you to disable the viewing of questionnaires, or display the questionnaire using a custom action. As with other
user-defined functions, it must be defined in the
PROC GLOBAL section.
The function can be defined without parameters, or with a single string parameter. If one string parameter is provided, then it will receive the name of the dictionary that forms the basis of the questionnaire.
Return
0, or a
special value, to prevent the default behavior of viewing the questionnaire. Returning any other value means that the questionnaire will be viewed.
In this example, the function prevents non-supervisors from opening the questionnaire view for the staff dictionary.
In this example, the input to view the main dictionary is constructed without the question text, overriding the default behavior that would show this information.