HomeGuidesRecipesAPI
HomeGuidesAPILog In
Guides
These docs are for v16. Click to read the latest docs for v31.

Copy Project Results to SQL Server Action

The Project Results to SQL server action takes form responses and outputs them to a relational database structure. The action is responsible for creating and maintaining a database schema as the form is created and maintained during its lifetime.

The action can be executed at the completion of a workflow state and or the final completion of a form. When the action is executed multiple times throughout a workflow the data kept will represent only the most recent submission.

Along with the actual response data, a collection of metadata fields such as user information, submission times and in progress/completion data is stored automatically with the records too.

As indicated but it's title the action creates a copy of the submitted data, it does not substitute data kept in the SmartIQ logs or database. It saves every field captured by the SmartIQ form so that all the data is available for present and future business analysis. Multiple actions can be added to output to multiple stores.

At a high level, the database schema will comprise of a base table that has a 1:* (one to many) relationship with any repeating/nested data contained within the form. Tables are named using the Form's title combined with a unique identifier and column names are titled using the Answer Name concatenated with the answers question reference. Columns are typed to match their question type. Each record has a unique 'rowId' so to make each record unique together with a runId representing the workflow transaction in SmartIQ

RowIdRunIdClient Name_q1.1Value_Q3.3Yes_q3.3No_q4.5DOB_q5.6
abc123def456SmartIQ500000.000000012000-01-01 00:00:00.000

Along with the tables for the actual Project Results a Schema Update table is kept to ensure that changes made to the form are reflected in the database form.

How to use the Copy Project Results to SQL Action

  1. Drag and Drop a copy of Project Results to SQL action either onto workflow step or the Finish page depending on at what point along the workflow you process requires the data.
1190
  1. The Action contains only one configurable setting, the connection string to which the results should be copied. A default can be applied at the environment level or applied individually at the individual-action level.
    To create a default connection string, go to the environment setting page in Manage > Settings > Project Results to SQL. Set the user id and password for the connection string. Enter the remaining Connection Attributes as a semi colon delimited string containing whatever settings are required eg:
    Server=myserverlocation;Initial Catalog=MyCatalog;Persist Security Info=False;MultipleActiveResultSets=True;Encrypt=False;TrustServerCertificate=False;Connection Timeout=30;
1599
  1. Complete your form in Produce and Ensure the data appears as expected in your SQL server instance.
1498

Question Types and Database Schemas

Different question types are mapped differently to their SQL equivalent as per the table below.

TypeDescription
Text BoxCreates a string, date or numeric field as per the question's properties.
Multiple ChoiceCreates a column for each possible selection of a bit (Boolean) data type indicating a selection. For the single-select question, a maximum of one will be selected, whereas a multiple-selection could have many.
Data SourceStores the unique identifier of the row selected.
Rich TextStores the rich text answer as an HTML string.
VariableStores the variables answer value as a string. Note as variables are calculated from other sources by default they are configured to not save. To change this, adjust the answer file properties to 'Save by built-in Answer ID'
Geo LocationStores the captured latitude and longitude as separate columns.

📘

Notes

  • Tables are automatically titled using the Forms name concatenated with a unique identifier where necessary. For Example MyForm
  • Columns are titled based on the questions answer name concatenated with the question's unique reference.
  • Separate parent/tables are created for Project Fragments and Repeating Sections.
  • Each child table maintains a relationship to its parent via a 'ParentRowId' column.
  • Infinite levels of data is supported by the parent/child table structure. (i.e. when a repeating section is located in a repeating section).
  • The various question types have unique behavior depending on the data that collect for example a Text Box vs Data Source vs Geolocation. See the table below for specifics.
  • If question(s) are added to the form coinciding columns will be added to the database schema, records previous to the question's addition will have NULL values.
  • If a question's datatype changes, for example from date to number. A new column will be created for the new data. the existing column will be kept but renamed.
  • A separate 'SchemaUpdate' table stores the last time the schema was updated.
  • Database administrators should only need to manage user access to the table, they should not need to make schema changes.
  • A maximum of 1024 columns is possible for any individual table.
  • Access to the data is possible only via a direct SQL Server connection