This topic is locked

In V11 make empty fields be null and not an empty string

10/21/2025 13:16:01
PHPRunner General questions
A
asawyer13 authorDevClub member

Is there a sql update statement I can do in the dev server database to make all fields put null in any field that's saved rather than an empty string?
In 10.91 I could edit the xml project and change every field but not sure how to do that in V11.
I know I can manually make the change in each field but it's a lot of work.
Thanks
Alan

ChatGPT 10/21/2025
Sergey Kornilov admin 10/21/2025

You can check $sqlValues parameter in BeforeAdd and BeforeEdit events. You can use this parameter to assign NULL values to any field i.e.:

$sqlValues["fieldName"]="null";

https://xlinesoft.com/phprunner/docs/before_record_added.htm

A
asawyer13 authorDevClub member 11/2/2025

In V10 and V11, there is a setting in Fields that will do what is needed without code.
It's a checkbox that says "Insert NULL values instead of empty strings".
I want this for all fields, so in V10, I could manually edit the project xml file and accomplish it.
In V11, that same value is stored somewhere, hoping there is a sql update statement I could run that would accomplish the same thing, so I wouldn't need to go into each field in the project as I have hundreds of fields.
Alan

W
wpl 11/5/2025

Alan,

what you are looking for is stored in the table "editformats", field "value" of the projects database. This field contains JSON as text.
There you can find the substring:

...,"textInsertNull":false,...

What database system are you using to store the projects?

Regards