I have lookup field, how to set 0 value when the field is null ?
as we know, a field that does not have a value will have a BLANK in dbgrid.
I can try to make calculated field like this :
if lookupfield1.Value = 0 then
calcfield.Value := 0
else
calcfield.Value := lookupfield1.Value;
But I will have many calculated fields to create.
Thanx
If I understand your question correctly, you want to know how you can make a grid display “0” instead of BLANK when a TIntegerField contains null.
A more simple approach than calc fields would be to use the OnGetText event
I’ve toyed with the DisplayFormat property… but it doesn’t seem to affect the display format for null values. (Not in TDBGrid at least…)