You are not logged in.
Pages: 1
I am trying to use DocVariantToObject to fill an object from a variant.
Looking at the code.
if prop <> nil then
prop^.Prop.SetValue(obj, doc.Values[p]);
This does not check the return-value of SetValue.
However, the return-value is false in case of complex fields.
So, when using this function with objects that contain classes like TCollection, then DocVariantToObject will not fill all fields.
Suggestion.
Valid := prop^.Prop.SetValue(obj,doc.Values[p]);
if (NOT Valid) then
begin
json:=TDocVariantData(doc.Values[p]).ToJson;
PropertyFromJson(prop,obj,pointer(json),Valid,JSONPARSER_TOLERANTOPTIONS);
end;
Offline
Offline
Working 100%. Thanks !!
Offline
Pages: 1