This video will review how you can use the Data Table and Entity Question Types in the questionnaires and encode them into documents.
Data Tables
These question types store information in such a way that the information must be cycled through in order to be outputted. Consider the following question:
Data Table Question: Who will be the officers of the corporation?
ID: officersTable
Column 1:
Question: Officer's Name
ID: name
Column 2:
Question: Officer's Position
ID: position
To properly encode the Word document template to generate the list of officers, it would be done as in the following example:
The officers are:
{#officersTable}{name}, {position}
{/officersTable}
If the user submitted the following answers to the question:
Data Table Question: Who will be the officers of the corporation?
Table Entry 1:
Name: Amy Alpha
Position: CEO
Table Entry 2:
Name: Billy Beta
Position: CTO
The output based on the encoding above would be the following:
The officers are:
Amy Alpha, CEO
Billy Beta, CTO
Alternatively, you could put the output into an actual table. The system is intelligent enough to know to create a new row for each officer entered using the following method:
Officer Name | Officer Position |
{#officersTable}{name} | {position}{/officersTable} |
The output would look like this:
Officer Name | Officer Position |
Amy Alpha | CEO |
Billy Beta | CTO |
Calculate the Number of Items in a Table
If you wish to display the total number of Officers that were entered in the table, you can do so by specifying the document output the "Table Length" using the code below.
Number of Officers: {officersTable.length}
Please check out our article on Questionnaire Question Types for a full list of available question types and links to more great videos like this one!