Drive me crazy…
Just in case this helps anyone out there –
It spent the last hour trying to figure out how to test if a variable is null or empty in Application Class PeopleCode on PeopleTools 8.47.
All()? Doesn’t work. None()? Nada. Those functions work on RECORD.FIELD structures only. Go figure. Maybe they fixed this in newer versions of Tools but no dice for 8.47. And forget PeopleBooks. No help there.
I had to dig through delivered Application Classes hoping to see how PeopleSoft themselves implemented these functions.
Want to test a string? Use (&var = “”) or (&var <> “”). Great! But guess what, this doesn’t work for date types.
To test whether a date variable is null, you have to do the following:
Local Date &mynulldate;
Then test (&mydate = &mynulldate). Yes, you have to create a new date variable (which points to a null date value) and then test against that. Amazing… Alternatively you can cast the Date or DateTime as string and then test to see if the string is empty.
In other words:
/* To test strings use: */
if &myvar = “” then /* do whatever… */ end-if;
if &myvar <> “” then /* do whatever… */ end-if;
/* To test dates use: */
Local Date &nulldate;
if &mydate = &nulldate then /* do whatever… */ end-if;
if String(&mydate) = “” then /* do whatever… */ end-if;




