Info
Content

Setting a Date to Null in PeopleCode


To set a date to null in PeopleCode either use the SetDefault() function (deprecated) or the SetDefault field method

Using the function:

SetDefault(YOUR_RECORD.DT_FIELD);

Using the field method If you are in the current context:

YOUR_RECORD.DT_FIELD.SetDefault();

Using the field method if you are not in the current context using a field object:

Local Field &fldDateExample;
/* Code to set your &fldDateExample object */
&fldDateExample.SetDefault();

Not intuitive but it works.

There is also another way to set a date to null via PeopleCode! In some cases, using SetDefault() to blank out a field is not what we're after, as there may be a default for the field! The only other way (to my knowledge) is this:

RECNAME.DATE_FIELD.Value = "";

.Value is the KEY here. Not including .Value will throw Syntax errors in App Designer when you try to assign the date field to "" and save your program.

No Comments
Back to top