Hi,
How to properly test if a numerical field on a form is empty?
I’ve tried a few options, first with a newly initialized form. Then I entered a value in the textbox and deleted it immediately. Then I ran the test a second time.
isNull
if isNull(oNumericalBox.value) then
msgbox "isNull true, value= " & oNumericalBox.Value
else
msgbox "isNull false, value= " & Cstr(oNumericalBox.Value) 'Cstr used to avoid an error
endif
'--> output 1st time: isNull false, value=
'--> output 2nd time: isNull false, value= 0
isEmpty
if isEmpty(oNumericalBox.value) then
msgbox "isEmpty true, value= " & oNumericalBox.Value
else
msgbox "isEmpty false, value= " & oNumericalBox.Value
endif
'--> output 1st time: isEmpty true, value=
'--> output 2nd time: isEmpty false, value= 0
= 0
if oNumericalBox.value = 0 then
msgbox "= 0 true, value= " & oNumericalBox.Value
else
msgbox "= 0 false, value= " & oNumericalBox.Value
endif
'--> output 1st time: = 0 true, value=
'--> output 2nd time: = 0 true, value= 0
It seems these three tests cannot be used to detect an empty numerical textbox or to differentiate between an empty textbox or a textbox with value = 0.
So what should I use instead?
tnx
ps using LO 6.2.8.2 (downloaded from the LO website) on Linux Mint 18.3 mate