Hi,
I am using RawInvokeAsync method to call Xdata api service methods but it seems not behaving properly. As you can see on following codes the method LoadCodeLookup is using async property to call RawInvokeAsync methods to get Codes lookup. The method LoadCustomerData is used to get a single Customer data where the custid=1. I am calling both the methods on webformshow event but it fails to call the LoadCodeLookup method in Async. As before loading data to XDataWebDataset1 in LoadCodeLookUp method the pointer goes to LoadCustomerData and executes that first.
Is this correct behavior? if yes, then how to make sure that it will execute the whole LoadCodeLookup method 1st with loading data into XDataWebDataset1 and then goes to LoadCustomerData method.
Following are webform codes...
type
TfrmCustomerEditor = class(TWebForm)
..........
procedure WebFormShow(Sender: TObject);
private
{ Private declarations }
[async]
procedure LoadCodeLookup;
procedure LoadCustomerData;
end;
implementation
{$R *.dfm}
procedure TfrmCustomerEditor.LoadCodeLookup;
var
res: TXDataClientResponse;
begin
res := await(XDataWebClient1.RawInvokeAsync('IcustomerService.GetCodeLookups', [LoggedUserId]));
XDataWebDataset1.Close; // this line not executing after the above line execute. the pointer goes to LoadCustomerData method//
XDataWebDataset1.SetJsonData(TJSObject(res.Result)['value']);
XDataWebDataset1.Open;
end;
procedure TfrmCustomerEditor.LoadCustomerData;
begin
//this method code executes before loading data into XDataWebDataset1 in LoadCodeLookup method//
webdsCustomer.Close;
webdsCustomer.EntitySetName := 'Customer';
webdsCustomer.QueryString := '$filter=custid eq 1';
webdsCustomer.Load;
end;
procedure TfrmCustomerEditor.WebFormShow(Sender: TObject);
begin
// it no behaving as async method call//
LoadCodeLookup;
LoadCustomerData;
end;
On above codes, when it executes the LoadCodeLookup method block's RawInvokeAsync method calling line then execution pointer goes to LoadCustomerData method instead of executing XDataWebDataset1.Close; line from LoadCodeLookup.
So is there any specific setting, units required to make the RawInvokeAsync calling work?
I am using following TMS product versions
Appreciate you help.