Blog

All Blog Posts  |  Next Post  |  Previous Post

TMS FNC Cloud Pack with StellarDS.io backend: unparalleled productivity in VCL & FMX

Bookmarks: 

Wednesday, April 3, 2024

On March 19th, we had the first public reveal and opening of the closed beta phase of our brand new service StellarDS.io

TMS Software Delphi  Components

Stellar DataStore is our fast and easy solution to let your application use a backend as a service. Using the power of our REST API, you can easily fetch and manipulate data in the cloud. StellarDS.io even enables you to set up a whole database with only a few API calls. We handle everything a backend might need, from data storage and manipulation to security and privacy. There is no need anymore for hosting servers or implementing new security measures. Stellar DataStore will handle this for you, leaving more room for implementing the things you want.

TMS FNC Cloud Pack & StellarDS.io

In this blog, we'd like to dive deeper in how the new TMS FNC Cloud Pack components make working with the StellarDS.io backend seamless. Giving you unparalleled productivity to create native VCL Windows applications and FireMonkey (FMX) cross-platform applications

TTMSFNCCloudStellarDataStore component

A first way to work with Stellar DataStore from a VCL Windows or FireMonkey (FMX) application is via the TTMSFNCCloudStellarDataStore component. This is a Delphi wrapper for the Stellar DataStore REST API. It basically allows to fully manipulate the metadata of your data in the backend and of course also perform CRUD operations on data (entities).

Via the TTMSFNCCloudStellarDataStore component, you have access to the collection of tables TTMSFNCCloudStellarDataStoreTables. In turn each table in this collection provides access to a collection of fields TTMSFNCCloudStellarDataStoreMetaData and collection of entities TTMSFNCCloudStellarDataStoreEntities. You can access each individual field in the Fields collection as TTMSFNCCloudStellarDataStoreMetaDataItem and each entity in the Entities collection as TTMSFNCCloudStellarDataStoreEntity. This way, you can add, delete, modify fields as well as add, delete, modify entities. 

This is a code snippet that shows you can use these classes to verify if a database is setup correct for a user and if not, initialize it with the fields needed:

uses
  FMX.TMSFNCCloudStellarDataStore, FMX.TMSFNCCloudDataStore, DB;

var
  sds: TTMSFNCCloudStellarDataStore;
  tbl: TTMSFNCCloudStellarDataStoreTable;
  mi: TTMSFNCCloudStellarDataStoreMetaDataItem;
begin
  sds := TTMSFNCCloudStellarDataStore.Create(Self);
  // set the api key to connect directly
  sds.Authentication.Key := apikey;
  sds.Mode := moSync;
  // get the default project ID
  sds.GetProjects;
  if sds.Projects.Count > 0 then
  begin
    sds.ProjectId := sds.Projects[0].ID;
    // check if the needed table exists
    sds.GetTables;
    if not Assigned(sds.TableByName(tablename)) then
    begin
      ShowMessage('Table not found, trying to create table automatically');
      sds.CreateTable(tablename);
      tbl := sds.TableByName(tablename);

      if Assigned(tbl) then
      begin
        //insert the needed fields for this table
        sds.TableId := tbl.ID;

        mi := sds.MetaData.Add;
        mi.PropertyName := fieldstatus;
        mi.DataType := ftString;
        mi.Size := 50;
        sds.AddMetaData(mi);

        mi := sds.MetaData.Add;
        mi.PropertyName := fielddescr;
        mi.DataType := ftString;
        mi.Size := 50;
        sds.AddMetaData(mi);

        mi := sds.MetaData.Add;
        mi.PropertyName := fielddate;
        mi.DataType := ftDate;
        sds.AddMetaData(mi);
      end;
    end;
  end;
  sds.Free;
end;


TTMSFNCCloudStellarDataStoreDataSetFMX / TTMSFNCCloudStellarDataStoreDataSetVCL components

Much easier is to start working with the TTMSFNCCloudStellarDataStoreDataSet components, especially with its strong design-time integration. Connect a TTMSFNCCloudStellarDataStoreDataSet to DB-aware controls and you are up & running. 
To initialize the dataset, invoke the design-time editor via the context menu:

TMS Software Delphi  Components

And from here, you can add, delete, update tables and for each table, you can add, delete, update fields:

TMS Software Delphi  Components

When you select a table and press the OK button, it will automatically initialize all fields in the dataset. Making it actually immediately ready to be used from DB-aware controls in native VCL Windows applications and FireMonkey (FMX) cross-platform applications.


Closed Beta

Sign up here to get a chance to enter the closed beta and get a head start developing full-stack applications. We will invite people at regular intervals to the Closed Beta. When you are eligible to join, you will receive an invitation through e-mail with you credentials.

Follow us now!

Show us support and follow us on our social media to always be up to date about stellards.io

TMS Software Delphi  Components

TMS Software Delphi  Components

TMS Software Delphi  Components

TMS Software Delphi  Components

TMS Software Delphi  Components

TMS Software Delphi  Components

Bart Holvoet


Bookmarks: 

This blog post has not received any comments yet.



Add a new comment

You will receive a confirmation mail with a link to validate your comment, please use a valid email address.
All fields are required.



All Blog Posts  |  Next Post  |  Previous Post