Start modelling your app today.

Get started for free

What's this?

Forms Data Structure

An introduction to the Codebots forms data architecture.


Introduction

The Codebots Forms behaviour allows for users to create forms for data collection operations without developer input. This article will go over the data structure used to store the forms in the application.

Modelling a Form

When modelling a form on the Codebots platform it will look like this:

An entity with a single form behaviour on it

Form Tables

When you create a model like this, the bot will create the following table structure in the database:

The forms table data structure

As can be shown by the diagram, there shall be 3 tables created for a Form entity:

  • MyForm - This is the table used to store the individual forms created by the user.
  • MyFormEntityFormVersion - This is the table used to store the versions of the forms a user has created. Every time a user makes a new form it will store it in a new version. The most important column in this table is FormData, which stores the JSON that represents the questions on the form.
  • MyFormSubmission - This table is where the users responses to a form a stored. The most important field on this table is SubmissionData, which is a JSON field that stores the answers corresponding to a questions in the version.

Customising Form Submissions

The fields on the MyForm table can be customised by adding extra attributes onto the Form entity; these will not change the submission. If we want to change the submission, we can update our model to this:

An entity with a single form behaviour on it, connected to a form submission

This Form Submission entity will be used for storing the form submission data instead of the default one, and can be customised to have extra entities and relations just like any other entity. This can be especially handy for doing things like linking submissions to users.

Last updated: 19 May 2020


Start modelling your app today.