Using the Customer Image on a report

midegomidego Member Posts: 51
Hello folks,

I have a customer card with an image on it. Table 18, field 140.
This field is a Media field, which works a bit different than the Picture field you were able to use before.

I can print the Image on an RDLC report when I load the field into the image box.
When I want to do it via the Setdata and Getdata the image does not display anymore.

I have searched on Google and what I find is that several developers are having issues with this, there is no solution that I can find.

Anyone here who has experience with this?

Answers

  • TallyHoTallyHo Member Posts: 417
    onaftergetrecord
    TempBlob.blob.CREATEOUTSTREAM(Outs);
    Customer.PICTURE.EXPORTSTREAM(Outs);

    Then just put the TempBlob.Blob in the report where your mediafield now is.
    I know.. why??. But it sure works the same as it used to ;)
  • midegomidego Member Posts: 51
    edited 2019-03-29
    In the example, you provide you use the Customer.Picture, but this should be the image.
    What kind of variable do I need to add for this?
  • TallyHoTallyHo Member Posts: 417
    Yes, you're right. I was just being creative.
    The code is written for a Media type field.
    The blob is still in the customer table too, but that's not what we're talking about indeed.
  • midegomidego Member Posts: 51
    edited 2019-03-29
    Unfortunately, it does not work as described above.
    In de dataset the blob has an *, so it indicated that it is being filled, but it does not load with the Getdata in the RDLC.
  • TallyHoTallyHo Member Posts: 417
    Ok, well then it probably is get and set data.
    Take a look how it is donw in report 206

    vovx1047c15w.png
  • TallyHoTallyHo Member Posts: 417
    edited 2019-03-29
    (so but a base64 string in the setdata, this probably works for update per customer)
  • midegomidego Member Posts: 51
    I have the following in the Expression.
    What do I write in the Setdata?

    8dzci1ccura3.png
  • TallyHoTallyHo Member Posts: 417
    edited 2019-03-29
    Write the tobase64string code in the setdata function.
    =convert.tobase64stiring(MyReportField)
    And just do Getdata(x,x) as you're used to in the image control in the report header.
    The picture box with mime type image/bmp wil create a jpg/bmp from the base64 string
    it retreives from the getdata. So that is different from the example in report 206.
    We're inventing this on the fly
  • midegomidego Member Posts: 51
    Thanks for your help, I'm quite new at this.
    Can you point me in the right direction to write the setdata?
  • TallyHoTallyHo Member Posts: 417
    5qg0kabtevgt.png
  • TallyHoTallyHo Member Posts: 417
    Setdata is done in a small hidden report control. Often situated behind the tablebox.
  • midegomidego Member Posts: 51
    I tried the above but I still don't get the images, unfortunately.

    ejqkav1b8lli.png
  • TallyHoTallyHo Member Posts: 417
    Can you post the entire content of the visibility property in plain text?
    I can check how your getdata should be from looking at it.
  • midegomidego Member Posts: 51
    =
    Cstr(Fields!ShipToAddr1.Value) + Chr(177) +
    Cstr(Fields!ShipToAddr2.Value) + Chr(177) +
    Cstr(Fields!ShipToAddr3.Value) + Chr(177) +
    Cstr(Fields!ShipToAddr4.Value) + Chr(177) +
    Cstr(Fields!ShipToAddr5.Value) + Chr(177) +
    Cstr(Fields!ShipToAddr6.Value) + Chr(177) +
    Cstr(Fields!ShipToAddr7.Value) + Chr(177) +
    Cstr(Fields!ShipToAddr8.Value) + Chr(177) +
    Cstr(Fields!SelltoCustNo_SalesShptHeader.Value) + Chr(177) +
    Cstr(Fields!SalesPersonText.Value) + Chr(177) +
    Cstr(Fields!ReferenceText.Value) + Chr(177) +
    Cstr(Fields!SalesPurchPersonName.Value) + Chr(177) +
    Cstr(Fields!YourRef_SalesShptHeader.Value) + Chr(177) +
    Cstr(Fields!CompanyAddr1.Value) + Chr(177) +
    Cstr(Fields!CompanyAddr2.Value) + Chr(177) +
    Cstr(Fields!CompanyAddr3.Value) + Chr(177) +
    Cstr(Fields!CompanyAddr4.Value) + Chr(177) +
    Cstr(Fields!CompanyAddr5.Value) + Chr(177) +
    Cstr(Fields!CompanyAddr6.Value) + Chr(177) +
    Cstr(Fields!CompanyInfoPhoneNo.Value) + Chr(177) +
    Cstr(Fields!CompanyInfoFaxNo.Value) + Chr(177) +
    Cstr(Fields!CompanyInfoVATRegtnNo.Value) + Chr(177) +
    Cstr(Fields!CompanyInfoGiroNo.Value) + Chr(177) +
    Cstr(Fields!CompanyInfoBankName.Value) + Chr(177) +
    Cstr(Fields!CompanyInfoBankAccountNo.Value) + Chr(177) +
    Cstr(Fields!CompanyInfoHomePage.Value) + Chr(177) +
    Cstr(Fields!CompanyInfoEmail.Value) + Chr(177) +
    Cstr(Fields!SalesShptCopyText.Value) + Chr(177) +
    Cstr(Fields!DocDate_SalesShptHeader.Value) + Chr(177) +
    Cstr(Fields!No_SalesShptHeader.Value) + Chr(177) +
    Cstr(Fields!ShptDate_SalesShptHeader.Value) + Chr(177) +
    Cstr(Fields!SalesShptCopyText.Value) + Chr(177) +
    Cstr(Fields!BankAccNoCaption.Value) + Chr(177) +
    Cstr(Fields!BankNameCaption.Value) + Chr(177) +
    Cstr(Fields!GiroNoCaption.Value) + Chr(177) +
    Cstr(Fields!VATRegNoCaption.Value) + Chr(177) +
    Cstr(Fields!PhoneNoCaption.Value) + Chr(177) +
    Cstr(Fields!SelltoCustNo_SalesShptHeaderCaption.Value) + Chr(177) +
    Cstr(Fields!ShipmentDateCaption.Value) + Chr(177) +
    Cstr(Fields!ShipmentNoCaption.Value) + Chr(177) +
    Cstr(Fields!HomePageCaption.Value) + Chr(177) +
    Cstr(Fields!EmailCaption.Value) + Chr(177) +
    Cstr(Fields!DocumentDateCaption.Value) + Chr(177) +
    Convert.Tobase64string(Fields!TempBlob.Value)
  • midegomidego Member Posts: 51
    When I add a second image box and set the expression to =First(Fields!TempBlob.Value, "DataSet_Result") it does work. But this is not the way it should be if I want to print it in batch.
  • TallyHoTallyHo Member Posts: 417
    It is not complete, I'm missing the setdata function at the beginning (I need that to know how to count)
  • midegomidego Member Posts: 51
    All the other field are working as they should?
  • TallyHoTallyHo Member Posts: 417
    "When I add a second image box and set the expression to =First(Fields!TempBlob.Value, "DataSet_Result") it does work. But this is not the way it should be if I want to print it in batch."

    Yes, that's why you need to encode to base64 from the report repeater.
  • TallyHoTallyHo Member Posts: 417
    =Code.SetData(Cstr(Fields!CustAddr1.Value) + Chr(177) +
    Cstr(Fields!CustAddr2.Value) + Chr(177) +
    Cstr(Fields!CustAddr3.Value) + Chr(177) +
    Cstr(Fields!CustAddr4.Value) + Chr(177) +
    Cstr(Fields!CustAddr5.Value) + Chr(177) +
    Cstr(Fields!CustAddr6.Value) + Chr(177) +
    Cstr(Fields!CustAddr7.Value) + Chr(177) +
    convert.tobase64stiring(MyReportField) + Chr(177) +
    Cstr(Fields!BilltoCustNo_SalesInvHdr.Value) + Chr(177) +
    Cstr(Fields!VATRegNo_SalesInvHdr.Value) + Chr(177) +
    Cstr(Fields!YourReference_SalesInvHdr.Value) + Chr(177) +
    Cstr(Fields!No_SalesInvHdr.Value) + Chr(177) +
    Cstr(Fields!HdrOrderNo_SalesInvHdr.Value) + Chr(177) +
    Cstr(Fields!PostingDate_SalesInvHdr.Value) + Chr(177) +
    Cstr(Fields!DueDate_SalesInvHdr.Value) + Chr(177) +
    Cstr(Cstr(Fields!PricesInclVATYesNo_SalesInvHdr.Value)) + Chr(177) +
    Cstr(First(Fields!DocDate_SalesInvHdr.Value)) + Chr(177) +
    Cstr(Fields!SalesPurchPersonName.Value) + Chr(177) +
    Cstr(Fields!DocumentCaptionCopyText.Value) + Chr(177) +
    Cstr(Fields!PaymentTermsDesc.Value) + Chr(177) +
    Cstr(Fields!ShipmentMethodDesc.Value) + Chr(177) +
    Cstr(Fields!CompanyAddr1.Value) + Chr(177) +
    Cstr(Fields!CompanyAddr2.Value) + Chr(177) +
    Cstr(Fields!CompanyAddr3.Value) + Chr(177) +
    Cstr(Fields!CompanyAddr4.Value) + Chr(177) +
    Cstr(Fields!CompanyAddr5.Value) + Chr(177) +
    Cstr(Fields!CompanyAddr6.Value) + Chr(177) +
    Cstr(Fields!CompanyInfoPhoneNo.Value) + Chr(177) +
    Cstr(Fields!OrderNoText.Value) + Chr(177) +
    Cstr(Fields!EMail.Value) + Chr(177) +
    Cstr(Fields!HomePage.Value) + Chr(177) +
    Cstr(Fields!CompanyInfoVATRegNo.Value) + Chr(177) +
    Cstr(Fields!CompanyInfoGiroNo.Value) + Chr(177) +
    Cstr(Fields!CompanyInfoBankName.Value) + Chr(177) +
    Cstr(Fields!CompanyInfoBankAccNo.Value) + Chr(177) +
    Cstr(Fields!PricesInclVAT_SalesInvHdrCaption.Value) + Chr(177) +
    Cstr(Fields!InvNoCaption.Value) + Chr(177) +
    Cstr(Fields!SalesInvPostingDateCptn.Value) + Chr(177) +
    Cstr(Fields!BilltoCustNo_SalesInvHdrCaption.Value) + Chr(177) +
    Cstr(Fields!CompanyInfoBankAccNoCptn.Value) + Chr(177) +
    Cstr(Fields!CompanyInfoBankNameCptn.Value) + Chr(177) +
    Cstr(Fields!CompanyInfoGiroNoCaption.Value) + Chr(177) +
    Cstr(Fields!CompanyInfoVATRegNoCptn.Value) + Chr(177) +
    Cstr(Fields!CompanyInfoPhoneNoCaption.Value) + Chr(177) +
    Cstr(Fields!PageCaption.Value) + Chr(177) +
    Cstr(Fields!ReferenceText.Value) + Chr(177) +
    Cstr(Fields!SalesPersonText.Value) + Chr(177) +
    Cstr(Fields!VATNoText.Value) + Chr(177) +
    Cstr(Fields!SalesInvDueDateCaption.Value) + Chr(177) +
    Cstr(Fields!DocumentDateCaption.Value) + Chr(177) +
    Cstr(Fields!PaymentTermsDescCaption.Value) + Chr(177) +
    Cstr(Fields!ShptMethodDescCaption.Value) + Chr(177) +
    Cstr(Fields!EMailCaption.Value) + Chr(177) +
    Cstr(Fields!HomePageCaption.Value)
    , 1)
  • TallyHoTallyHo Member Posts: 417
    edited 2019-03-29
    Code.Getdata(1,8) is where my picture is, encode in base 64

    Put this as expression in the image control in the header, with image type bmp/jpg
  • midegomidego Member Posts: 51
    Unfortunately, I still don't get the image.
    Left is with convert 64 and right just the field.

    4txr9ezzwf3z.png


  • midegomidego Member Posts: 51
    edited 2019-03-29
    I changed the expression in the image to =Convert.FromBase64String and now it is working.
  • TallyHoTallyHo Member Posts: 417
    yes! thats it
  • midegomidego Member Posts: 51
    Thanks for the help :)

    Cheers!
  • TallyHoTallyHo Member Posts: 417
    You're welcome
Sign In or Register to comment.