Can't get IsNull to work properly

I can’t seem to figure out why this won’t work. It only works if both fields contain something.

local StringVar newtext:=totext({FA.lock_box});
newtext:=replace(newtext,"True", "YES");
newtext:=replace(newtext,"False", "NO");
newtext:=replace(newtext,"TRUE", "YES");
newtext:=replace(newtext,"FALSE", "NO");
newtext;

local StringVar newtext2:=totext({FA.occupancy});
newtext2:=replace(newtext2,"VACANT", "VAC");
newtext2:=replace(newtext2,"OWNER", "OWN");
newtext2:=replace(newtext2,"TENANT", "TEN");
newtext2;

"Occ:" + ( if not IsNull( {FA.occupancy} ) then totext(newtext2) else " " ) &
" Lkbx:" + ( if not IsNull( {FA.lock_box} ) then totext(newtext) else " " );

kdlklm (BOB member since 2008-06-26)

Top Tip, if you edit the subject line of your post to something meaningful, you are more likely to get help.


Nick Daniels :uk: (BOB member since 2002-08-15)

I got it to work now.

local StringVar newtext:=( if not IsNull( {FA.lock_box} ) then totext({FA.lock_box}));
newtext:=replace(newtext,"True", "YES");
newtext:=replace(newtext,"False", "NO");
newtext:=replace(newtext,"TRUE", "YES");
newtext:=replace(newtext,"FALSE", "NO");
newtext;

local StringVar newtext2:=( if not IsNull( {FA.occupancy} ) then totext({FA.occupancy}));
newtext2:=replace(newtext2,"VACANT", "VAC");
newtext2:=replace(newtext2,"OWNER", "OWN");
newtext2:=replace(newtext2,"TENANT", "TEN");
newtext2;

"Occ:" + ( if not IsNull( {FA.occupancy} ) then totext(newtext2) else " " ) &
" Lkbx:" + ( if not IsNull( {FA.lock_box} ) then totext(newtext) else " " );

kdlklm (BOB member since 2008-06-26)