#1 2020-08-09 17:41:36

Mo0211
Member
Registered: 2018-12-30
Posts: 24

Getting TStringlist-Value from Json-Database

hi,

i setup a TStringList-Value in my Database, which Values are currently shown in Json-Format.

What is the best way, getting those Values back from Database and write them in a local TStringList Variable?

i thought i can do it like this:

fSQLRecord.Liste :=fSQLRecordRec.Liste;

Where fSQLRecordRec is filled with fillone, but the value is nil everytime.
All Other Strings and Integer Values are written in this way.

I searched already for the JSONToObject-function, but i didn't get it working and don't know if it is needed to do like that.

Thanks for your support!

Offline

#2 2020-08-09 19:12:47

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: Getting TStringlist-Value from Json-Database

So I guess your TSQLRecord field is a TStringList.
The instance needs to be initialized before. Try a TRawUTF8List property - which should also be initialized via TSQLRawUTF8List.Create before FillOne.
Or just define a variant - the JSON will be converted into a TDocVariant which is easy to work with.
Check https://synopse.info/files/html/Synopse … ml#TITL_26

Offline

#3 2020-08-09 19:24:37

Mo0211
Member
Registered: 2018-12-30
Posts: 24

Re: Getting TStringlist-Value from Json-Database

ab wrote:

So I guess your TSQLRecord field is a TStringList.
The instance needs to be initialized before.

Thats the trick!

Thanks for your really quick answer smile

Offline

Board footer

Powered by FluxBB