Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
Delphi

Cross Platform Business Stats Dashboard App For Delphi 10.2.1 Tokyo On Android And IOS

The Hospitality Survey Client project is part of the Hospitality Survey App template for Delphi 10.2.1 Tokyo that Embarcadero has released through their GetIt platform. The Hospitality Survey App consists of four different projects plus a Survey Question Editor. And now there is a sixth project I am releasing for the Hospitality Survey App which is a Hospitality Survey Admin Client built in Delphi 10.2 Tokyo. The original business stats dashboard included with the Hospitality Survey App is built in AngularJS but I wanted to also build this same dashboard in Delphi.

I based the Hospitality Survey Admin Client off of the Hospitality Survey Client source code and just modified it a bit. The original client only downloaded the survey questions and then uploaded the results. I modified the client so that it downloads the admin business stats, a CSV file of the email addresses for the users who filled out the survey, the list of completed surveys, and the details of each individual survey. I only needed to add 4 new REST API calls to do this.  The code to dynamically generate the client survey form was modified to display the survey results dynamically. The relevant new API calls in the Admin Client are listed below:

GET /survey/results/* – Download the survey results in a paged fashion in FireDAC JSON format. The page number is placed where the * is.
GET /survey/stats/all – Download various stats about the survey results in FireDAC JSON format.
GET /survey/details/* – Download the questions and answers from a specific survey ID in FireDAC JSON format. The survey ID is placed where the * is.
GET /survey/emails/csv – Download a list of all of the email addresses from completed surveys in CSV format.

The JSON that is returned is already in FireDAC JSON format (from RAD Server) so it can be easily loaded into a TFDMemTable. The stats dashboard itself uses various FireMonkey objects to display some of the stats and it also uses TeeChart Lite which comes with Delphi 10.2 Tokyo to display the 3 charts. I tried to achieve the same look and feel of the dashboard in the Admin Client as the original AngularJS admin client. Here is the code below to load up the stats into the business dashboard. As you can see TeeChart Lite is pretty easy to use and the charts work across Android, IOS, OSX, and Windows with a single codebase and single UI. What is not visible in the code for TeeChart Lite is that the first Series chart has to be created by right clicking the chart component and selecting Edit Chart… and then choosing the Add… button to create the first chart Series. Once you create the first chart and select the chart type you can then start adding data to the chart via code.

Delphi 10.2 Tokyo has a built in project statistics package which shows you where you are using your time in the IDE when you are developing a project. Below is a screenshot of the time it took to modify the Hospitality Survey Client and turn it into the Hospitality Survey Admin Client. There was some extra debugging time needed to work out some display issues with TeeChart Lite on Android but other than that it was a pretty fast build.

Here is a screenshot of the original AngularJS Hospitality Survey Admin dashboard. It is styled with Bootstrap and uses a Javascript chart library.

Finally, here is a screenshot (see below) of the Delphi 10.2 Tokyo Hospitality Survey Admin Client which uses FireMonkey styling and TeeChart Lite for the business stats dashboard.

Download the full cross-platform source code of the Hospitality Survey Admin Client for Delphi 10.2 Tokyo.

Do you want to create an app for iOS, Android, macOS, and Windows? Try the Cross-Platform App Builder for the healthcare industry, which can help you create apps in the Delphi or C++ environments.
See What's New in 12.2 Athens See What's New in 12.2 Athens Dev Days of Summer 2-24

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

About author

FMXExpress.com has over 600 articles with all kinds of tips and tricks for Delphi FireMonkey on Android, IOS, OSX, Windows, and Linux.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES