Possible Bug in SET value to NULL

Wappler Version : 2.1.5
Operating System : Windows 10

Steps

Server Action > Database Update (SQL Server, Classic ASP)
Set a numeric value (INT) to NULL

Actual behavior

Sets Value to ‘NULL’

How to reproduce

Server Connect to SQL Database
Server Connect Action Database Update
Update Table Set Field (Which is an INT) = NULL
Can be resolved by manually changing the DMXConnect script and removing the surrounding single quotes
from
"query": "UPDATE Contact\nSET Cont_Status = :P1 /* {{$_POST.StatusDropdown}} */, Cont_Deleted = 'NULL'\nWHERE Cont_ContactId = :P2 /* {{$value}} */",

to

"query": "UPDATE Contact\nSET Cont_Status = :P1 /* {{$_POST.StatusDropdown}} */, Cont_Deleted = NULL\nWHERE Cont_ContactId = :P2 /* {{$value}} */",

I also had the edit the steps
so that it read (null)

                  "table": "Contact",
                  "column": "Cont_Deleted",
                  "type": "number",
                  "value": (null)

You could try with {{null}} as value, it should be evaluated to NULL.

2 Likes

@patrick setting {{null}} doesn’t work for me. In the following example, I am trying to set ‘data_order’ to NULL irrespective of what is in the DB column already.

image

Does those columns have “ allowed null” as database field option? Maybe you have defined a database default value?

Hi @George, it is set to allow NULL and default NULL.

So whether a digit has been previously entered or not, it should still allow this query to put a NULL in place, shouldn’t it? Or maybe {{null}} should be put in the condition column?

@UKRiggers
What server model and database are you using?
I just tested with PHP/Mysql with an INT(5) field type and on update {{null}} sets the field to null.

1 Like

Hi @Teodor, let me go back to it and try again. Then I’ll come back with details. Cheers

Thanks @patrick
Confirmed with ASP/SQL
int and tinyint are updated to NULL when setting value as {{null}}

1 Like