Omitting fields when inserting data

Omitting fields when inserting data

rheinertprheinertp Posts: 23Questions: 4Answers: 0

Hi,
is it possible to omit fields when inserting a new row into a table?
Background:
I have defined some default values for fields in the database table - and I do not want to
define this default in the code.

But when I do a "direct insert" like
editor.create(false).set('active', false).set('stepid', stepid).submit()
also the other fields are set to "null" - but I want to make just an insert as
"INSERT INTO tblstep (active, stepid) VALUES (0, stepid)"
which then takes the database table defaults for the other values.

Thanks!
PAscal

Answers

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    Hi @rheinertp ,

    Editor would just pass that field as empty to the server, so it'll be the server script that's converting that to null. You could create a default value on the client with fields.def, but if that's no good, you'll need to add some logic into that server-side.

    Hope that helps,

    Cheers,

    Colin

This discussion has been closed.