This topic is locked

I'm having '0's instead of 'Null's

7/18/2008 9:43:28 AM
PHPRunner General questions
V
vytb author

In the fields formatted as 'int' and default values are 'Null', I'm having the '0's after adding a record. How to avoid them?
'0's would be grotesque values in some cases...

S
steveh 7/18/2008

either no formatting at all, or detect it in the custom format and conditionally format.

V
vytb author 7/18/2008

either no formatting at all, or detect it in the custom format and conditionally format.


Thanks Steve, you are attentive like always. However, not formatting (varchar?) is not an option. These are numeric values of different formats.
Custom view or conditionally format can be troublesome because the value can be or cannot be '0'. Still, I don't understand why PHPR puts zeroes when default value is null!

S
steveh 7/21/2008

I've not tried this but you coudl also add a dummy field in the sql
select realfield1,realfield2,'' as MyDummy from sometable
Then have this as your entry field checked for numeric and not required, then in the before update handle it accordingly?
I do this quite a lot for other reasons as I often want to have a record split out into multiple tables at save time so it can work.

V
vytb author 7/21/2008

Thanks Steve,
Jane gave me a good suggestion to use following code in the "Before record added" event:

---------------------------------------

if ($values["nn"]=="")

unset($values["nn"]);

---------------------------------------
So far it functions well.
... except, that I would still like to handle this using default value in 'edit as' box.