Save data NULL value

bart99.hermans266 14 Jun, 2025

Hi Max,

There was another topic about saving a NULL value to the database, but that was not the same as my case.

I'm trying to write the value NULL to the database by using "Modify data source" in the "Save data" operator. This results in a INSERT or UPDATE query, depending on if there is a WHERE clause or not.

 

However, in the query the NULL value is added as a string "NULL", causing SQL errors and of course not writing the correct data to the database.

What can I do to solve this?

Best regards,

Bart

Max_admin 14 Jun, 2025
Answer

Hi Bart

Do not include the field in the list of fields in "Modify data source", if the table column has NULL as the default value then it will get NULL

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
bart99.hermans266 16 Jun, 2025

Hi Max,

Sure, I can do it that way in case of "INSERT" statement. But not if it is an "UPDATE" statement.

In this example I overwrite values only for a specific set of data.

Max_admin 16 Jun, 2025

Then you can use {const:null} instead of NULL in the "Modify Data Source"

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
You need to login to be able to post a reply.