Error when adding single record into a table

Hello, support,

This must be a very simple detail I am missing but I am getting an error when trying to insert a record in a table with only two fields.

id => serial
cycle_name => varchar
cycle_date => date

I have two queries, one that reads the data and the other that inserts.
Table Name is PaymentCycle

Cycle_Name and Cycle_Date are the column names and the Changeset are

{{PaymentCycle.newRow.Cycle_Name}}
{{PaymentCycle.newRow.Cycle_Date}}

I did not specify anything for id as PostgreSQL is supposed to take care of that one but then I got the error message in preview mode when adding a new record.

{"status":422,"message":"insert into "cycles" ("cycle_date", "cycle_name") values ($1, $2) returning * - null value in column "cycle_name" of relation "cycles" violates not-null constraint","statusCode":422,"error":"Unprocessable Entity"...

I have read the documentation but nothing works. Somehow the Changesets are not retrieving the newly entered values in the table.

ok, I got it resolved by changing the Changeset to

{{PaymentCycle.newRow.cycle_name}}
{{PaymentCycle.newRow.cycle_date}}

1 Like