From wiki.ginstr.com
Jump to: navigation, search

Questionnaire

Widget generates questionnaire with internal widgets. Questionnaire can group GBAM widgets to become part of questionnaire. Questionnaire "questions" can be dynamically changed based on configuration of questionnaire in database.

Widget id, ${gbamID}:

questionnaire

Back to GBAM widgets table

Predefined user data

PreLoaded

Properties panel

User will configure this data in properties panels of selected widget:

GENERAL
  • -
VALIDATIONS
  • -
ACTION
  • "external widgets to save", ${listOfExternalWidgets}, list of comma separated ${widgetID} widget id's. All widgets on screen that have "is part of database" are in the list, by default nothing is selected.
ACTION MESSAGES
  • -
DATABASE
  • has no "is part of database" flag. It is not part of database.

Widgets that can be grouped by questionnaire

GBAM widget ${gbamID} = Questionnaire widget (questionnaire widgetID) :

Code snippets

GBAM Code Variables

Variables which are used in code snippet below but not defined in user modifiable inputs.

  • ${listOfExternalWidgets} = for each external widget selected in the list add questionnaireResults_${dbColumn},@variable/${widgetID}; last occurrence has no ; at the end
  • ${externalColumns} - for each widget that is selected in list "external widgets to save". Column generated is based on external widget gn:dataType

Common widget code

<com.ginstr.widgets.GnQuestionnaire
    android:id="@+id/${widgetID}"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:fillViewport="true"
    gn:configurationSetTableName="questionnaireConfiguration"
    gn:configurationSetName="${widgetID}"
    gn:resultsTableName="questionnaireResults"
    gn:loadExternalData="${listOfExternalWidgets}"
    gn:style="@style/questionnaire"/>

configuration.xml

Table configuration for add to configuration.xml node <configuration>:

<tables>
	<table id="questionnaires" name="questionnaires">
		<columnText id="questionnaires_name" name="questionnaires_name" />
	</table>

	<table id="questionnaireConfiguration" name="questionnaireConfiguration">
		 <columnPointer id="questionnaireConfiguration_configurationSetName" name="questionnaireConfiguration_configurationSetName">
			 <table>questionnaires</table>
			 <column>questionnaires_name</column>
		 </columnPointer> 	
		 <columnNumber id="questionnaireConfiguration_sequenceNumber" name="questionnaireConfiguration_sequenceNumber" />
		 <columnText id="questionnaireConfiguration_language" name="questionnaireConfiguration_language"><valuesList><value>en</value> <value>de</value> <value>es</value> <value>fr</value> <value>it</value> <value>ae</value></valuesList></columnText>
		 <columnText id="questionnaireConfiguration_labelValue" name="questionnaireConfiguration_labelValue"/>
		 <columnText id="questionnaireConfiguration_hint" name="questionnaireConfiguration_hint"/>
		 <columnStatus id="questionnaireConfiguration_required" name="questionnaireConfiguration_required"/>
		 <columnText id="questionnaireConfiguration_requiredErrorMessage" name="questionnaireConfiguration_requiredErrorMessage"/> 
		 <columnText id="questionnaireConfiguration_widget" name="questionnaireConfiguration_widget"><valuesList><value>group</value> <value>text single line</value> <value>text multi line</value> <value>number integer</value> <value>number decimal</value> <value>status</value> <value>timestamp</value> <value>date</value> <value>radio group</value> <value>picture</value> <value>drop down list text</value><value>drop down list numeric</value><value>number</value><value>signature</value></valuesList></columnText>
		 <columnText id="questionnaireConfiguration_valueList" name="questionnaireConfiguration_valueList">
		   <multiline>true</multiline>
		 </columnText>
		 <columnText id="questionnaireConfiguration_comments" name="questionnaireConfiguration_comments"/> 
	</table>

	<table id="questionnaireResults" name="questionnaireResults_resultsTable" replicateFromServer="table">
		 <columnPointer id="questionnaireResults_questionnaireName" name="questionnaireResults_questionnaireName">
			 <table>questionnaires</table>
			 <column>questionnaires_name</column>
		 </columnPointer>
		 <columnPointer id="questionnaireResults_labelValue" name="questionnaireResults_labelValue">
			 <table>questionnaireConfiguration</table>
			 <column>questionnaireConfiguration_labelValue</column>
		 </columnPointer> 
		 <columnText id="questionnaireResults_textValue" name="questionnaireResults_textValue"/>
		 <columnNumber id="questionnaireResults_numberValue" name="questionnaireResults_numberValue"/>
		 <columnDate id="questionnaireResults_dateValue" name="questionnaireResults_dateValue"/>
		 <columnDateTime id="questionnaireResults_dateTimeValue" name="questionnaireResults_dateTimeValue"/>
		 <columnStatus id="questionnaireResults_statusValue" name="questionnaireResults_statusValue"/>
		 <columnPicture id="questionnaireResults_pictureValue" name="questionnaireResults_pictureValue"/>
                 ${externalColumns}
	</table>
</tables>

data.xml

Based on widgets that are grouped into questionnaire predefined data will be generated in data.xml

  • ${numberIncrementQuestionnaire} - Starts from 1. Take biggest row id and increment by 1.
  • ${numberIncrementConfiguration} - Starts from 1. Take biggest row id and increment by 1.
  • ${questionnaireName} =
<row id="${numberIncrementQuestionnaire}">
    <column id="questionnaireConfiguration_name">
        <value>${widgetID}</value>
    </column>			
</row>
  • ${questionnaireWidget} =
<row id="${numberIncrementConfiguration}">
    <column id="questionnaireConfiguration_configurationSetName">
        <value>${questionnaireNameRowId}</value>
    </column>
    <column id="questionnaireConfiguration_sequenceNumber">
        <value>${sequenceNumber}</value>
    </column>
    <column id="questionnaireConfiguration_language">
        <value>${language}</value>
    </column>
    <column id="questionnaireConfiguration_labelValue">
        <value>${labelValue}</value>
    </column>
    <column id="questionnaireConfiguration_hint">
        <value>${hint}</value>
    </column>
    <column id="questionnaireConfiguration_required">
        <value>${required}</value>
    </column>
    <column id="questionnaireConfiguration_requiredErrorMessage">
        <value>${requiredErrorMessage}</value>
    </column>
    <column id="questionnaireConfiguration_widget">
        <value>${widget}</value>
    </column>
    <column id="questionnaireConfiguration_valueList">
        <value>${valueList}</value>
    </column>
    <column id="questionnaireConfiguration_comments">
        <value>${comments}</value>
    </column>
</row>
  • ${questionnaireNameRowId} - row id of the questionnaireName currently used
  • ${sequenceNumber} - order in GBAM from top to bottom of widgets grouped by questionnaire defines sequence number. First widget on top has sequence number 1.
  • ${language} - create for each language provided in GBAM duplicate of the row ${questionnaireWidget} with incremented ${numberIncrementConfiguration} - and edit the values according to current language selected in GBAM
  • ${labelValue} - ${widgetLabel} user entered label for widget
  • ${hint} - ${widgetHint} user entered hint for widget
  • ${required} - status required selected on widget , if true value should be x if false then empty node
  • ${requiredErrorMessage} - error message for required on widget (default or override depends on widget)
  • ${widget} - questionnaire widgetID depending on mapping
  • ${valueList} - used only with widgets radio group,drop down list numeric,drop down list text values of items in dropdown or radio group should be separated with \n here
  • ${comments} - empty node, not used in GBAM

Grouped together data for data.xml:

<tables>
	<table id="questionnaires">
		${questionnaireName}
	</table>
	<table id="questionnaireConfiguration">
		${questionnaireWidget}
	</table>
</tables>

column values in xml have to comply with import RULES

${valueList} for:

dropdownDatabaseText

Each item for dropdown value is separated by a &#xA; separator. i.e. itemOne&#xA;itemTwo&#xA;itemThree

dropdownDatabaseNumber

Each item for dropdown value is separated by a &#xA; separator. i.e. 1&#xA;2&#xA;3

Internal controls layout for questionnaire widgets

Questionnaire: DateEditable

Questionnaire: Dropdown database number

Questionnaire: Dropdown database text

Questionnaire: Heading one

Questionnaire: Number Integer

Questionnaire: Number Decimal

Questionnaire: Number default

Questionnaire: Photo

Questionnaire: Radio Group

Questionnaire: CheckBox

Questionnaire: Text editable

Questionnaire: Text editable

Questionnaire: Label

Questionnaire: Radio Button

Questionnaire: Signature