No Data Update via XDataWebDataSet1

I am using Aurelius and a XData Server, to display and manipulate data from a database in a web form (simple description for the project :slight_smile: )
I used the data modeller to create the entities units, also easy and nice to use!

Displaying the data with dbedit fields works fine, but ! as soon i want to update data in the database using ApplyUpdates and Post, i fail....

await(XDataWebDataSet1.ApplyUpdates);
no error, but also no XDataWebDataSet1AfterApplyUpdates event, and on the database side no data change.
On the server side there is no wxDataServerEntityModified or TwxBaseClassWebAccessMain.wxDataServerEntityModifying event triggered.

If i use the swaggerui to manipulate the database, data is changed, and all events on the server side are triggered...

Any clue what is missing, thx for your help (again)

br
Michael

I'm not sure you can use ApplyUpdates in an Await(), although I think (hope) that ApplyUpdatesAsync will be in the next release.

Hi,
thx for the answer.

i previously tried XDataWebDataSet1.ApplyUpdates, but no difference...

br
Michael

That's strange. I use it extensively and haven't had any problems. Have you got any auth attributes on your entities maybe?

You could set the [OnUpdating/OnInserting] event on you your entity and then put a break point in it to see if it is at leaset getting that far. Or use the event on the XDataServer to check the update/insert is being called.

Hi,

thx for your answer.

If i change a dabase field value using a TWebDBEdiit, i can see that the following event is triggered.

procedure TForm1.WebDataSource1UpdateData(Sender: TObject);
begin
console.log('update data');
end;

If i call WebDataSet1.ApplyUpdates i get NO event for XDataWebDataSet1AfterApplyUpdates, but there is also no error.

On the server side, i can see the EntityList Event, for loading the data from database.
But there is no EntityModified, ServerEntityModifying or ServerEntityInserted eventg trigggerd .

I believe that if there was an Auth problem, the server should raise an execption

br
Michael

Be aware that after the database field value is changed using the TWebDBEdit, you need to call Post method of the dataset to persist changes to the record and effectively "queue" such change to be applied.

Only then you should call ApplyUpdates, which are supposed to send the pending updates to the server.

Other than this, please check the network tab of your browser developer tools, to see if any HTTP request is executed when you call ApplyUpdates, and if they do, check the results (the server might be returning an error).

and again the problem is in front of the monitor....
first post the data and then ApplyUpdates seems to solve the problem.

Thx to everyone

br
Michael

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.