TsgcWSPClient_Dataset › Events › OnMetaData
Fires when the server answers a GetMetaData request with the Dataset field definitions.
property OnMetaData: TsgcWSMetaDataEvent;
// TsgcWSMetaDataEvent = procedure(Connection: TsgcWSConnection; const JSON: IsgcObjectJSON) of object
—
Raised in response to a GetMetaData call. JSON is an array where each item describes a server-side field through the properties fieldname, datatype, datasize and keyfield. Use this event to build a client-side Dataset schema that matches the server before performing an initial Synchronize.
procedure TForm1.oProtocolMetaData(Connection: TsgcWSConnection;
const JSON: IsgcObjectJSON);
var
i: Integer;
vFieldName, vDataType: string;
vDataSize: Integer;
vKeyField: Boolean;
begin
for i := 0 to JSON.Count - 1 do
begin
vFieldName := JSON.Item[i].Node['fieldname'].Value;
vDataType := JSON.Item[i].Node['datatype'].Value;
vDataSize := JSON.Item[i].Node['datasize'].Value;
vKeyField := JSON.Item[i].Node['keyfield'].Value;
end;
end;