601
Views
1
Comments
Check if binary data is empty
Question

I have an excel template and it's size is (9 846 bytes), when I try to upload this excel to import a file there´s one validation which is not working. I have tryied to check if the binarycontent is equal to nullbinary and also to check with BinaryDataSize action from BinaryData Extension.

Is there a way I can check if this excel file is reaaly empty, I mean the template has two sheets with headers but if I upload this template without no content on the template I need a validation to work.

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

Hi Lucas,

It seems that you don't want to know whether a binary is empty (which is indeed done via a check against NullBinary() or with BinaryDataSize()), but want to know whether the Excel file contains any rows. An empty Excel file still has a lot of meta data, so its size is not 0 (you can verify this by using the Windows Explorer).

To check whether the Excel file contains data, just use a ExcelToRecordList, and check whether the resulting List is empty or not. For any more fine-grained checks, you'll need to use one of the Forge components, like Advanced Excel, that allow you to inspect each cell for its content.

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