Empty Cart

Knowledgebase

Using SAM to check for a blank date field

Oftentimes in our workflows we need to compare a date field in our database to determine what happens next.  However, what do you do if there is no value in the date field you are comparing? The idiom to test if a date field in Act! is non-blank (contains a valid date) is to use the Compare Field pre-condition.

Set the Fieldname to be the Act! date field you're comparing, the Operation to "x*y" (contains), the Value to the constant "/" (with the quotes), and set Type (optional)  to "Text."

This will make SAM convert the date field value to a string internally. If the field contains a valid date, that string will contain "/" (at least in the US). If the field does not contain a value, the converted string will be completely blank and therefore not contain a "/" character.

You can use this as the first pre-condition in a stack of pre-conditions to test for a valid date and then test for the date within a range if there actually is a date. Follow that by an action to do a calculation.

Patricia Egen Consulting, LLC

803 Creek Overlook, Chattanooga, TN 37415
Main office: 423-875-2652 • Arizona office: 480-788-7504 • Florida office: 754-300-2827
support@egenconsulting.com