Options

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

  • Options
    TallyHoTallyHo Member Posts: 383
    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 ;)
  • Options
    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?
  • Options
    TallyHoTallyHo Member Posts: 383
    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.
  • Options
    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.
  • Options
    TallyHoTallyHo Member Posts: 383
    Ok, well then it probably is get and set data.
    Take a look how it is donw in report 206

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

    8dzci1ccura3.png
  • Options
    TallyHoTallyHo Member Posts: 383
    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
  • Options
    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?
  • Options
    TallyHoTallyHo Member Posts: 383
    5qg0kabtevgt.png
  • Options
    TallyHoTallyHo Member Posts: 383
    Setdata is done in a small hidden report control. Often situated behind the tablebox.
  • Options
    midegomidego Member Posts: 51
    I tried the above but I still don't get the images, unfortunately.

    ejqkav1b8lli.png
  • Options
    TallyHoTallyHo Member Posts: 383
    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.
  • Options
    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)
  • Options
    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.
  • Options
    TallyHoTallyHo Member Posts: 383
    It is not complete, I'm missing the setdata function at the beginning (I need that to know how to count)
  • Options
    midegomidego Member Posts: 51
    All the other field are working as they should?
  • Options
    TallyHoTallyHo Member Posts: 383
    "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.
  • Options
    TallyHoTallyHo Member Posts: 383
    =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)
  • Options
    TallyHoTallyHo Member Posts: 383
    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
  • Options
    midegomidego Member Posts: 51
    Unfortunately, I still don't get the image.
    Left is with convert 64 and right just the field.

    4txr9ezzwf3z.png


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

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