We have an XData server that opens a Query returning a Stream using BatchMove method depicted in tutorial: TMS XData: Accessing any database with SQL queries via the TMS XData REST server - YouTube
So the returned JSON is very simple, by records, in order to be easy to load on a basic web app.
To load the data we use the following code:
procedure TFLicenses.btnRefreshClick(Sender: TObject);
var
Response : TXDataClientResponse;
aOrganisationSecretKey : String;
JSObjectResponse : JS.TJSObject;
aStrResponse : String;
aStream : TMemoryStream;
aStrList : TStringList;
begin
XDataWebClientLicense.Connection := XDataWebConnectionLicense;
Response := await(XDataWebClientLicense.RawInvokeAsync('IMagisterLicenseService.GetOrganizationLicensesForWeb', ['EIFGLN99STWHIJ8U', 19, -1]));
JSObjectResponse := TJSObject(Response.Result);
aStrResponse := JS.toString(JSObjectResponse);
WebMemo1.Text := aStrResponse;
end;
Obviously, I see the data in the WebMemo JSON formatted by fields. It has the following very simple syntax.
[{
"ID_ORGANISATION_LICENSE":107,
"ID_MAGISTER_LICENSE":99,
"APPLICATIONID":1,
"DISTRIBUTIONID":6,
"IDORGANISATION":3648,
"IDLOCATION":7872,
"LICENSE_TYPEOF":1,
"NAME":"Smartcash Hq - Licenta Permanenta Aplicatie",
"DESCRIPTION":"",
"OTHER_INFO":"Marina",
"PRODUCT_VERSION":19,
"PRICE":900,
"VAT_PERCENT":19,
"ACQUISITION_CONTRACT":"1",
"ACQUISITION_CONTRACT_DATE":"20220129",
"LICENSE_EXPIRE_DATE":"21001231",
"ISACTIVATED":1,
"LAST_ACTIVATION_DATE":"20220209T154233",
"LAST_VALIDATION_DATE":"20220301T072554",
"ORGANISATION":"Magister Software SRL",
"ORGANISATION_PHONE_1":"0318210150",
"ORGANISATION_PHONE_2":"0751517380",
"ORGANISATION_EMAIL_1":"dor@magister.ro",
"ORGANISATION_EMAIL_2":"dor.padureanu@gmail.com",
"ORGANISATION_CITY":"Bucuresti",
"ORGANISATION_CODE":"",
"ORGANISATION_COUNTRY":"Romania",
"ORGANISATION_STATE":"Sector 2",
"ORGANISATION_STREET":"Str. Radu de la Afumati nr. 62",
"SUBSCRIPTION_EVENT_DATE":"20260101",
"SUBSCRIPTION_PERCENT":10,
"SUBSCRIPTION_ACTIVE":1,
"ORGANISATION_ISACTIV":1,
"ORGANISATION_CRM_CODE":"ACC488",
"LOCATION":"Magister Software SRL - Departament Analiza",
"LOCATION_TYPEOF":1,
"LOCATION_PHONE_1":"0318210150",
"LOCATION_PHONE_2":"0751517380",
"LOCATION_EMAIL_1":"analiza@magister.ro",
"LOCATION_EMAIL_2":"dor.padureanu@gmail.com",
"LOCATION_CITY":"Bucuresti",
"LOCATION_CODE":"",
"LOCATION_COUNTRY":"Romania",
"LOCATION_STATE":"Sector 2",
"LOCATION_STREET":"Str. Radu de la Afumati nr. 62",
"USER_ACTIVATION":"Marina Bibac"
},
{
"ID_ORGANISATION_LICENSE":108,
"ID_MAGISTER_LICENSE":99,
"APPLICATIONID":1,
"DISTRIBUTIONID":6,
"IDORGANISATION":3648,
"IDLOCATION":7871,
"LICENSE_TYPEOF":1,
"NAME":"Smartcash Hq - Licenta Permanenta Aplicatie",
"DESCRIPTION":"",
"OTHER_INFO":"ionut",
"PRODUCT_VERSION":19,
"PRICE":900,
"VAT_PERCENT":19,
"ACQUISITION_CONTRACT":"1",
"ACQUISITION_CONTRACT_DATE":"20220129",
"LICENSE_EXPIRE_DATE":"21001231",
"ISACTIVATED":1,
"LAST_ACTIVATION_DATE":"20220214T120750",
"LAST_VALIDATION_DATE":"20220302T100300",
"ORGANISATION":"Magister Software SRL",
"ORGANISATION_PHONE_1":"0318210150",
"ORGANISATION_PHONE_2":"0751517380",
"ORGANISATION_EMAIL_1":"dor@magister.ro",
"ORGANISATION_EMAIL_2":"dor.padureanu@gmail.com",
"ORGANISATION_CITY":"Bucuresti",
"ORGANISATION_CODE":"",
"ORGANISATION_COUNTRY":"Romania",
"ORGANISATION_STATE":"Sector 2",
"ORGANISATION_STREET":"Str. Radu de la Afumati nr. 62",
"SUBSCRIPTION_EVENT_DATE":"20260101",
"SUBSCRIPTION_PERCENT":10,
"SUBSCRIPTION_ACTIVE":1,
"ORGANISATION_ISACTIV":1,
"ORGANISATION_CRM_CODE":"ACC488",
"LOCATION":"Magister Software SRL - Departament Software",
"LOCATION_TYPEOF":1,
"LOCATION_PHONE_1":"0318210150",
"LOCATION_PHONE_2":"0751517380",
"LOCATION_EMAIL_1":"software@magister.ro",
"LOCATION_EMAIL_2":"dor.padureanu@gmail.com",
"LOCATION_CITY":"Bucuresti",
"LOCATION_CODE":"",
"LOCATION_COUNTRY":"Romania",
"LOCATION_STATE":"Sector 2",
"LOCATION_STREET":"Str. Radu de la Afumati nr. 62",
"USER_ACTIVATION":"Ionut Lesnic"
}...]
Now, my question is, how can I load it in a XDataWebDataset or any dataset compatible with TMS WebCore Apps?
My goal is to show it in a grid and do some updates on the selected record.
Thank you