TXDataWebDataset.Append not working and raised error but works fine with TXDataWebDataset.Insert method..

Hi,

I am getting error, when I call TXDataWebDataset.Append method to add some extra data at client side.

I have a XDataWebdataset on a form and I am getting data from XData service by using SetJSONData method. I am able to see the fetched data in a DBGrid with the help of a linked datasource component.
But I am getting error when I use XDataWebdataset.append method to add a new row. And If I use XDataWebdataset.Insert method then it works fine.

Is this designed behavior or I am missing some point?

Thanks,

And what is that error?

I am using following code..

//getting data
  XDataclient1.RawInvokeAsync('IcallService.GetCustomerCalls', [inMonth, inYear]); 
  XDataWebDataset1.SetJsonData(TJSObject(Response.Result)['value']);
  XDataWebDataset1.Open;
  XDataWebDataset1.First;
//adding new record by using append and getting error 
  XDataWebDataset1.Append;
  XDataWebDataset1custno.AsString := 'Cust101';
  XDataWebDataset1contact.AsString := '9898989898';
  XDataWebDataset1.Post;

I am getting following error.. in log file
localhost-1691154636612.log (1.6 KB)

If you see the following image then it is not showing the new record.

If you see following image where I used XDataWebDataset1.Insert instead of Append then it worked without any error.

This code is wrong:

You are calling RawInvokeAsync without await. That doesn't wait for the method to return to execute the next statements. Make sure you call it using await.

Sorry, for writing mistake.
My code is

//getting data
var
res: TXDataClientResponse;
...............
  res := await(XDataclient1.RawInvokeAsync('IcallService.GetCustomerCalls', [inMonth, inYear])); 
  XDataWebDataset1.SetJsonData(TJSObject(Response.Result)['value']);
  XDataWebDataset1.Open;
  XDataWebDataset1.First;
//adding new record by using append and getting error 
  XDataWebDataset1.Append;
  XDataWebDataset1custno.AsString := 'Cust101';
  XDataWebDataset1contact.AsString := '9898989898';
  XDataWebDataset1.Post;

But still getting the same above error on XDataWebDataset1.Append

Can you please send a small project reproducing the issue? I just can't tell what's wrong just from the provided code.
Can you maybe try to remove the First call after Open, since it's not needed?

I checked with FireDACSQL demo and found that it is working.
It seems, I missed some point at my project and I will check in details.

Thanks for you help.

1 Like

The error seems to be a Grid filling issue. Do you have the same error if you someway disconnect the grid from the dataset, Append, Post, and then reconnect them?