#1 2018-02-21 03:49:48

Ghiber
Member
Registered: 2016-02-17
Posts: 14

Problem creating a TDocVariantArrayDataSet dataset

Hello, I'm having problems doing some tests like in example 17 TClientDatase something like that

fJSON:='[{"Id":"1","Name":"Ghiber","DateTime":"2018-02-20T19:22:51"}]'

values.InitJSON(fJSON,JSON_OPTIONS[true]);

ds1.DataSet := ToDataSet(self,values.Values,['Id','Name','DateTime'],[ftInt64,ftUTF8,ftDate]);

the date generated in the dataset is null.
debugging I found that the SynVirtualDataSet unit exists a function called TDocVariantArrayDataSet.GetRowFieldData which has a condition

case fColumns [F] .FieldType of
           ftDouble, SynCommons.ftDate:
             VariantToDouble (Values [ndx], PDouble (@ fTemp64) ^

there would be the possibility that this variant is processed something like this

           SynCommons.ftDate:
             VariantToDateTime (Values [ndx], PDateTime (@ fTemp64) ^);

note: this line generates the date well but not the time

in the mormot documentation explains that this class TDocVariantArrayDataSet is used for mongodb can generate a VCL dataset, but there is the
possibility of creating a property where it indicates that the TVariantDynArray is generated from another source as explained in example 17

Offline

Board footer

Powered by FluxBB