Questionnaires

Add a Questionnaire to a View

Technologies > Software Engineering Techniques > Advanced Techniques > Display a Questionnaire in a Form

Technologies > Software Engineering Techniques > Advanced Techniques > Display a Questionnaire in a Column

To add a questionnaire to a view, create an instance of the questionnaire control, passing the Questionnaire Code (questionnaire_id) and the panel id in which the questionnaire should appear. Note that the panel may be of type form or columnReport :

this.quest = new Ab.questionnaire.Quest(q_id, 'exPrgQuestionnaireForm_form');

Before saving an edit form containing a questionnaire, call beforeSaveQuestionnaire() to write the question answers to the questionnaire response field in XML format:

this.quest.beforeSaveQuestionnaire();

Items to Include in the View File

The following items must be included in the AXVW file:

  • the hidden questionnaire response field, for example:

<field name="project_quest" table="project" hidden="true" />

  • a view panel including the view file: ab-questionnaire.axvw . This view file includes the data source for the questionnaire:

<panel type="view" id="viewPanelId" file="ab-questionnaire.axvw"/>

Displaying a Questionnaire in a Read-Only Report

By default, a panel of type form will display editable questionnaire fields and a panel of type columnReport will display read-only questionnaire fields. To have a read-only questionnaire appear in a panel of type form , set the optional readOnly parameter to true :

this.quest = new Ab.questionnaire.Quest(q_id, 'exPrgQuestionnaireForm_form', true);