Recent

Author Topic: [SOLVED] How to check for NULL field in Script code?  (Read 3908 times)

Graeme

  • Hero Member
  • *****
  • Posts: 1428
    • Graeme on the web
[SOLVED] How to check for NULL field in Script code?
« on: July 03, 2015, 05:56:52 pm »
This is what I'm trying to do, but LazReport tells me Undefined symbol: NULL.

Code: [Select]
begin
  if [DSMain."Beoordeling3"] = Null then
    Text := '<null>'
  else
    Text := FormatFloat('0.00', [DSMain."Beoordeling3"]);
end;
« Last Edit: July 03, 2015, 06:18:18 pm by Graeme »
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

Graeme

  • Hero Member
  • *****
  • Posts: 1428
    • Graeme on the web
Re: [SOLVED] How to check for NULL field in Script code?
« Reply #1 on: July 03, 2015, 06:19:27 pm »
Okay, I figured out I can use the Length() function to achieve what I want. Here is a working example:

Code: [Select]
begin
  if [LENGTH([DSMain."Beoordeling1"])]>0 then
    Text := FormatFloat('0.'+[PuntDecimals], [DSMain."Beoordeling1"])
  else
    Text := '<null>';
end;
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

 

TinyPortal © 2005-2018