Working on a report where I import a user's signature as an image from a db and put it in the report. Not all users have signatures in the system, so in those cases I get a red 'X' on my report. Is there a way for infragistsics to just not put an image on the report if the field is null?
I'm thinking something like this:
If(IsNull(First(Fields.Signature, DataSources.MyDB)), ????, First(Fields.Signature, DataSources.MyDB))
But I don't know what to use in the '????' place.
Hello Tyler,
Thank you for your post. I have been looking into it and I can say that you can bind the Visibility of the Image. You can set the Expression like this:
=IsNull(Fields.Photo)
Where Photo is the name of the Field which contains the byte[] of the image. This way if the Field is null the image will be hidden and there won’t be any red “X”. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.
Thank you for the reply, I was out yesterday and didnt get back to this until just now. I tried changing the expression for the image field to:
=IsNull(Fields.Image)
and also tired =IsNull(First(Fields.Image, DataSources.MyDB))
But when running the report I get this error:
Infragistics.Reports.Engine.EngineException: An error has occurred while processing an Image report item. ---> System.ArgumentException: Object of type 'System.Boolean' cannot be converted to type 'System.Byte[]'.
The expression I suggested you should be set to the Image's Visibility Property, not its Image one. I attached a screenshot showing how the Image should look like. Please let me know if this helps you or you need further assistance on this matter.
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
That worked perfectly, thank you.