Unable to set a value or save data

When I do something such as, after putting the dataset in insert mode

  xds_Reg_Type.AsString := 'B';

I get errors like this

ops.js:288 Uncaught TypeError: Cannot set properties of undefined (setting 'Reg_Type')
at Object.SetJSONDataForField (ops.js:128952:22)
at Object.SetJSONDataForField (ops.js:130157:66)
at Object.SetJSONDataForField$1 (ops.js:127600:12)
at Object.SetFieldData$1 (ops.js:128864:25)
at Object.SetFieldData (ops.js:107190:12)
at Object.SetData (ops.js:103585:21)
at Object.SetAsString (ops.js:103705:12)
at Object.xds_BeforeInsert (ops.js:147147:25)
at Object.cb (ops.js:255:26)
at Object.DoBeforeInsert (ops.js:106673:44)

It doesnt matter which field I set programmatically, I get a similar error.

If I comment those out and enter the values in the WebDbEdit boxes, and post it. I cant see any errors in the browser or the server. But the record is not present in the database.

I am guessing its the same reason.

I don't know what might be the cause. I need more information, more code. Ideally a small project reproducing the issue.

Are you setting the dataset into edit mode first? Using the WebDBEdit Boxes will automatically do this (through the TWebDataSource if AutoEdit = True). But setting the value in code won't trigger this.

Assuming xds is the dataset

If not xds.state in dsEditModes then
   xds.Edit;

xds_Reg_Type.AsString := 'B';

On the database side, are you calling xds.ApplyUpdates after the post?

At design time, I can populate the fields of the grid. However at run time, I get errors as above. Also, grids show blank instead of existing records. Again no errors. So I am missing something somewhere,

If I use the wizard for creating a TMS XData Web Application, then grid display works.

But what I had done was following Holgers video to start with a TMS Web Bootstrap Application and then add xdata.

So, I have obviously missed something.

The template has other code which I would have had to add later, so I am going to merge the two projects first.

@Weetch_Russell

Yes mentioned, I was doing the operations after putting it into insert mode.
However, I have not done ApplyUpdates.

How do you open the dataset?