I have a customer that is doing drop shipments and they want the customer's logo to be displayed in the header area of the report. Since the sales shipment report supports multiple documents, each of which can have its own logo, I cannot do the usual trick in the header of simply pointing to First(Fields!CompanyInfoLogo.Value) in the image properties of the logo and just change it to the customer logo. Worth noting that the image expression property only appears to support a First() incidence of any particular field name if setting a database value.
What I have tried to do is a bastardization of the older style (2013/2013r2) method of setting the logo using the Convert.To/FromBase64String:
- I have created Code functions at the report level that use a shared public object LogoData. These are pretty much identical to the GetData/SetData standard functions, only without bothering with field separators as they only are for the logo image. These are intended to be called by the Hidden property expression and can be passed a value to set as the return value.
- In the first column of my table group header (grouped by the specific shipment header, no parent group) I have a hidden cell named LogoDataValue with the value of "=Convert.ToBase64String(Fields!CustomerLogo.Value)". A couple of header cells later in the same row I use the visible property expression "=Code.SetLogoData(ReportItems!LogoDataValue.Value,FALSE)" (false parameter is the value to be returned).
- The image control in the header has the expression property of "=Convert.FromBase64String(Code.GetLogoData())". Image source is set to Database, mime type is image/bmp.
I'm not getting any errors, but the image displayed is the standard X of a bad image.
I am doing a calcfields on the custom field Customer."Customer Logo" field (blob, subtype bitmap) in the Sales Shipment Header - OnAfterGetRecord so I'm not making that rookie mistake.
Has anybody managed to get this sort of thing working? I might be able to convince my customer to store images externally, in which case I could try to load external images on the fly based on a "image location" field, but I wanted to see if I could get this working first. I'd be entirely open to a different method of trying to set/get the image data as well.
Report level functions are as follows:
Public Shared LogoData as Object
Public Function SetLogoData(Logo as Object, RetVal as Boolean) as Boolean
LogoData = Logo
Public Function GetLogoData() as Object