With the latest versions of 4D, there are various ways to store data of any type such as using an object variable, a collection, or even the Variant type variable. When using these in scenarios where the data type can vary, it would be best to implement some checks when comparing. For example, if a date or a text formatted date can be contained in a variant, if the variant is assigned a date type and then compared to an empty string (""), an error will appear due to the mismatched typing.
4D contains many native ways to get the type of the data such as the commands Type and OB Get type. It would be best to perform a type check before making a comparison in scenarios where the data type may vary.