322
Views
6
Comments
Check Binary Data Size of BinaryContent field
Question
Application Type
Reactive
Service Studio Version
11.54.30 (Build 62899)

I want to set an expression based on whether there is data in a binarycontent field.

This is the entity setup:


This is the data in the attribute:


If the field shows BinaryData (0 bytes) I want to have a specific value in the expression.

I tried this as it was the only thing I saw that might work, but it doesn't work.

  • If(GetCustomerDocumentsByCustomerId.List.Current.CustomerDocuments.BinaryContent = NullBinary(), "Signature Required","Signed")


 

2023-08-28 07-00-10
Paulo Torres
Champion

Hello Paula,

Easy way is before or after to save check the data size.

Regards

2022-07-07 18-45-50
Niels Favreau

First of all 
I would not use the BinaryData extension in the case of a reactive application.
It's a server action, not client a client action.

Second of all
Maybe take the following suggestions into consideration which will also help with overall performance

Use case 1:
If the record in the CustomerDocuments table does not always contain binary data I would not put the Binary data attribute in the same Entity.

I would alter your relationships to the following: (example)Use your JOINS/PK's/FK's to do the checks, not the BindaryData

It also allows you to play with JOINS in your query and only fetch the information when it is required. Improving query performance

Use case 2:
If the record in the CustomerDocuments table always contain binary data, I would use the PK of CustomerDocument record to do the check, instead of the BinaryData attribute.
On top of that, instead of putting the condition in your UI, you could make your join With or Without and put the condition in a calculated attribute of your query.


Based on your use case both solutions would improve query performance

2021-10-01 12-43-46
N_SG

Hi @Paula Wright ,

If you want to  check binary data size and if  you want to check on the server side, you can follow the method suggested by Paulo above. For client-side validation, you can use JavaScript. I have attached an OML  from which you can handle validation on the client side.

Hope It helps!

Regards
N_G


BinaryData.oml
UserImage.jpg
Paula Wright

Thank you! I'll take a look at this. I believe it should be done on the client side before saving.


2021-10-01 12-43-46
N_SG
UserImage.jpg
Paula Wright

I believe the easiest solution is to figure out if there is a value before saving the signature. I'm working behind someone else and I'm unfamiliar with SignaturePads so I'm still trying to figure it out. 

Currently, a customer would click a button to bring up the SignaturePad. Then they have two choices - to clear or click Done. If Done is clicked then it calls a client action to update the entity but there is no check to see if there's a value. If there's nothing it pops an unnecessary empty record into the entity. I need to figure out how to check this before updating.

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