Check if Binary Data is null 

Check if Binary Data is null 

  
Hi

How do I check if a Binary data attribute is null (or has content) ? I've tried "<attribute> = NullBinary()", however I get an error message saying 2 binaries cannot be compared.

Accoring to the help on the NullBinary() function, the check above should work

Any ideas?
Solution
Hi Bilal,

The "=" operator is not valid for Binary Data. There's a Compare function in the BinaryData extension that lets you compare two variables of type Binary Data. Compare(yourBinaryDataVariable, NullBinary()) works fine, for example. You could also use the BinaryDataSize function from the same extension. It returns 0 if theres no binary content.
Solution
Hi Kilian

Thanks.  Works like a charm

Bilal
Hi Bilal,

Good to hear! Glad I could be of help.

Kilian Hekhuis wrote:

Hi Bilal,

The "=" operator is not valid for Binary Data. There's a Compare function in the BinaryData extension that lets you compare two variables of type Binary Data. Compare(yourBinaryDataVariable, NullBinary()) works fine, for example. You could also use the BinaryDataSize function from the same extension. It returns 0 if theres no binary content.

Hi,

How can I get the BinaryData extension? Is it on Forge? I am new to OutSystems


Hi Chetan,


It is part of the System Components, so you should already have it in your environment. Try to find it in the Add Reference screen.


Also just for the record: on the next major version it will also be possible to compare with NullBinary() to check if a binary is empy.


Regards,

João Rosado

João Rosado wrote:

Hi Chetan,


It is part of the System Components, so you should already have it in your environment. Try to find it in the Add Reference screen.


Also just for the record: on the next major version it will also be possible to compare with NullBinary() to check if a binary is empy.


Regards,

João Rosado

Thank you for the information