Build Dynamic Forms At Runtime With Hospitality Survey Editor For Delphi 10.2 Tokyo

by Sep 8, 2017

Embarcadero has released a Hospitality Survey App template for Delphi 10.2 Tokyo through their GetIt platform. The Hospitality Survey App consists of four different projects. A client app built with FireMonkey for Android, IOS, OSX, and Windows where users can fill out survey information. A web app built with AngularJS for viewing survey stats. A REST server built with RAD Server for Windows and Linux. And a setup app which is used to configure the whole system. You can customize the questions during the setup process but not afterward.

What is missing from these four projects is a way to edit the dynamic form questions on the server after you deploy the template to production. I have created a Hospitality Survey Editor app which will connect to your existing Hospitality Survey database and allow you to customize the questions which are asked in the client. The questions are stored in a table in the database and then downloaded to the client as JSON through RAD Server. The Hospitality Survey Client app loads the JSON and then dynamically creates the input fields using TFrames.

The Hospitality Survey Editor app was created by stripping down the Hospitality Survey Setup app and connecting it directly to the Hospitality Survey database. Here is a list of the dynamic fields that you can customize in this new editor:

ID – An ID for the question. You should increment the number of the ID for each new question you add.
name – A short name for the question with no spaces.
title – The text of the question as it will appear in the survey.
type – The type of question controls which question template is loaded on the client. The existing types are: rating, yesno, edit, options
options – If the type of the question is set to options this field is used to populate the options. It's value is a JSON array of options.
value – The value is where the user submitted data is stored. It can be left blank but could be used to provide a default answer.
category – The category of the question. This field is provided for expandability.
tenant_id – The tenant ID of the question. If the tenant_id field is blank all tenants will get the question. If it is set to a tenant only that tenant will get the question.

Download the full source code for the Hospitality Survey Editor in FireMonkey for Delphi 10.2 Tokyo.

Note: You need the Hospitality Survey Template from GetIt to be able to use this.

 Hospitality Survey Editor for RAD Server