Adam’s April 2021 Meeting Summary


  • Digging into LiveBindings – Stephen Ball
  • Event-based and Asynchronous Programming in Delphi – Dalija Prasnikar
  • Nugget: JSON and XML in Postgress – Lorenz Wolf

Adam’s Summary

News/Problem Clinic

Jason chaired a meeting which started with general chat about 10.4.2. Members are generally really positive about this release, with a few complaints of random bugs and behaviour. There seems to be a positive sense in the community that things are moving in the right direction.

The Python language & new tools to integrate Python into Delphi were discussed in some detail, with a few grumbles from members that Embarcadero were doing this while C++ support in the product is still pretty ropey. But most members felt that additional support for a new language was valuable.

The possibility of a Python-focused meeting was discussed. Members with Python-based skills were encouraged to suggest talks they could give.

Digging into LiveBindings – Stephen Ball

LiveBindings is the mechanism for connecting data to UI in Delphi which supersedes DB Controls. Rather than using a Datasource, LiveBindings projects use a BindingSource, which connects to a dataset/datasource.

The Delphi IDE includes a nice visual designer which allows “drag and connect” to link data-fields in LiveBindings through to Properties on UI or other Delphi objects.

LiveBindings takes the old DB Control metaphor and extends it very substantially, decoupling the data-management process from a one-to-one relationship with UI. It is quite magical, with lists and multi-levelled data (master-detail and lists containing lists) all managed seamlessly, once the BindSource(s) and BindingsList(s) have been set up. A fantastic additional feature is the ability to link things other than pure data-fields such as data-related properties to UI, for example linking the “Filtered” value of a dataset to a tick-box.

Stephen then showed Binding UI elements to an ObjectList using a BindSourceAdapter, I have added some images to this post to show screen-shots of code and IDE-UI, to give a bit more space for the breadth of Stephen’s talk.

LiveBindings can bind to any TList descendent, including the trusty old TStringList, giving it great power to interpret object-oriented data.

Event-based and Asynchronous Programming in Delphi – Dalija Prasnikar

Dalija Prasnikar, Embarcadero MVP gave a short introduction to her book “Event Based and Asynchronous Programming”, and her many on-line resources including: amd

Then went on to a Q&A session, covering issues around use of Threads, Queues and Critical Sections. These are constructs to allow programmers tasks to continue in a program without “blocking” the user interface. Typical examples would be calls to up-load a large file. Using threads allows such a process to occur while the user continues to do something else. The main problems come with concurrency issues, in the case above for example what to do if the user changes the name of the file part-way through a copy, or exits the program before the copy process is complete.

Delphi has plenty of good support for Threading built in. Dalija also mentioned the old but well written and reliable OmniThread library, a large, open source Delphi library of threading classes and functions. She believes OmniThread is seldom needed, as Delphi’s internal libraries are reasonably good, but it is there if you need to go deeper.

JSON and XML in Postgress – Lorenz Wolf

Lorenz Wolf then gave an excellent presentation on Postgres. The focus was on its handling of complex data-types, but he touched on multiple other features.

New versions of Postgres allow inclusion of datafields in tables which contain JSON formatted data. Fields can be added and SQL can be written to directly query the underlying JSON content. This is incredibly powerful in a modern work where data is widespread and often only loosely structured. Using JSON allows packets of data to be stored where the precise format of each row may differ significantly, including the ability of fields to contain nested sets of other data.

Lorenz accesses Postgres within Delphi using the UniDAC data-library, which he described as excellent and decent value for money. He uses the PGAdmin Utility to manage his Postgres databases, and showed this in use. It has excellent capabilities, and is a free, open-source tool. He pointed out that Postgres includes built in data-types for many complex data-types, mapping, shapes, lines, points, IPAddresses etc., etc. which are useful if you have specialized data-storage needs in this type of sector

Postgres allows JSON to be saved into fields either in plain text or binary format. Binary is recommended as it is more compact and faster to access, but slightly slower to import.

Lorenz demonstrated Postgres SQL used to extract specific sub-nodes of JSON data from a field, such as:


id, dataj->>’name’::varchar(200) AS name ,

jsonb_array_elements_text(dataj->’tags’)::varchar(2000) as tag

FROM MyTable

In the above, “dataj” is the name of the JSON containing field. The “->>” operator indicates “in dataj find the element ‘name'”.

Lorenz then downloaded JSON data from a Shopify website, and showed how it was possible to import this into Postgres and query it, returning multiple rows for multi-part JSON which was all stored in a single row in the database.

A strong talk which revealed some amazing power in Postgres. Detailed Postgres JSON functions shared by Lorenz here: