Suppress printing
Wim Ardon
Hi all!I would like to suppress printing of a label in case the corresponding value is empty. I've added some code to the Render/Visible label like this:
Document("U_BASKLA") <> " " AND Document("U_BASKLA") <> Null
The first condition works fine, but if U_BASKLA IS NULL, suppressing print is not done.
What is the correct syntaxis of checking whether or not a value is NULL?
Thanks
Wim
Andreas Eugster
The correct Syntax is:if(Document("U_BASKLA") <> " " AND not LD.IsEmpty(Document("U_BASKLA")) then.....
LD.IsEmpty() is testing on DB is NULL AND field is Empty (""). But in your test isn't very good. Because if now a field NULL then is a Exception the result, because you couldn't test on NULL (first test Document("U_BASKLA") <> " " ). That no Exception is the result you must first test on NULL and after on the value:
if(not LD.IsEmpty(Document("U_BASKLA"))) then
if(Document("U_BASKLA") <>"") then
Philipp Knecht
Hi Wim , hi AndreasJust to clarify: When using DataBand("Field") Syntax and the DataBand is an AdvancedDataband then the the Value DBNull will be automatically converted into:
- "" If it's an Text column
- 0 if it's an Numeric column
(You may disable this behaviour in the Misc DataBand Properties)
So it's enough to test DataBand("Field")<>"" If it's an Text Column.
If you pull the Data via GetData("...") you may use Data("...") instead to get also the above mentioned behaviour.
If you would like to check for DBNull within DataBand it's best to use : DataBand.IsNull("Field")
hth
0
Please sign in to leave a comment.
Comments
0 comments