2724
Views
10
Comments
Solved
Check if Binary Data is null
Question
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?
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
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.
UserImage.jpg
Chetan Yewale

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


UserImage.jpg
Malalai Habibullah

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 Kilian,

I follow the step but it is not working or may be I am doing something wrong.



2018-10-05 16-52-09
Bilal Haniff
Hi Kilian

Thanks.  Works like a charm

Bilal
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Hi Bilal,

Good to hear! Glad I could be of help.
2012-03-16 12-21-09
João Rosado
Staff

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

UserImage.jpg
Chetan Yewale

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


UserImage.jpg
Isha Hura

Hi,

I have tried "<>" operator, Compare and BinaryDataSize in mobile app development but it isn't working. Basically, the BinaryData API is not working in case of mobile. Please shed some light here what to use in mobile development in Outsystems for checking image attribute.


Regards,

Isha

2012-03-16 12-21-09
João Rosado
Staff

Hi Isha,


For mobile you can use the " = NullBinary()" to check if its empty. Not sure if the "<>" operator was implemented, but you can always do a "not (somevariable = NullBinary())" as alternative if you really want a negated expression.


Regards,

João Rosado

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Malalai,

You did not follow my instructions, at least I don't see the Compare Function, and you use "=", which I explicitly stated doesn't work.

UserImage.jpg
David Gabriel

I want to create validation if no data in record list, system end the process. how???

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.