Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

SSRS - Display Image in a report from an Image column Type

Posted on by 873

Hello,

I have a custom table in dataverse that has an Image column as a data type. I created one record for this table and uploaded a png image.

pastedimage1660075114452v1.png

I started building the SSRS Report that is linked to that table to display the image uploaded.

Below is the issue that I am facing:

It seems that the Image column type in dataverse does not save the content of the image as base64 and to display the image in the report requires this content.

Do I have to create a "Text Area" field hidden to convert the uploaded image to base64 and make the report rely on this field? If so, how can we do it via plugins?

Can please someone provide an example of how can we convert the image to base64, set the results in the text area field using the plugin, and when the plugin should be triggered?

Any help is highly appreciated.

Best regards,

EBMRay

  • Suggested answer
    JasonMcandrew Profile Picture
    JasonMcandrew 40 on at
    RE: SSRS - Display Image in a report from an Image column Type

    Thanks for your help with this, I've been looking to implement product images in our quote report.

    My findings were that the EntityImage column is in fact Base64 encoded already. The problem is the data type "Image" is not supported when adding EntityImage in the FetchXML of my Dataset in Visual Studio.

    I created a new text column and used a simple flow to copy the value from EntityImage into the new column. I can now include the text column in my report using the method System.Convert.FromBase64String() which is working perfectly.

  • EBMRay Profile Picture
    EBMRay 873 on at
    RE: SSRS - Display Image in a report from an Image column Type

    Hello  ,

    Thank you so much for spending your time and providing a detailed step-by-step to achieve this requirement.

    I will follow your steps and get back to you if I encounter any issues.

    Your help is greatly appreciated!!

    Best regards,
    EBMRay

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: SSRS - Display Image in a report from an Image column Type

    Hi EBMRay,

    It's really a hard work and took me a long time. Finally, works out. Please follow the steps:

    1. Create a field to store the base64 string.(Please Maximize the field length.)

    pastedimage1660206627458v2.png

    2. Create an onchange event on your Image field.

    pastedimage1660206812761v3.png

    Code is like this:

    var validator = false;
    async function changeImage(executionContext){
        if(validator){
            return;
        }
        var formContext = executionContext.getFormContext();
        var image = formContext.getAttribute("cr1bc_companylogo").getValue();
        formContext.getAttribute("new_longbase64").setValue("");
        if(image){
             var base64 = await toBase64(image["_file"]);
    	   formContext.getAttribute("new_longbase64").setValue(base64.replace("data:image/jpeg;base64,",""));
    	   validator = true;
        }
    }
    
    const toBase64 = file => new Promise((resolve, reject) => {
        const reader = new FileReader();
        reader.readAsDataURL(file);
        reader.onload = () => resolve(reader.result);
        reader.onerror = error => reject(error);
    });

    3. Open your form and change the image. The 'LongBase64' would auto filled.

    pastedimage1660206960087v4.png

    4. Create a SSRS report with the following FetchXML:

    
    
    
    
    
    
    
    
    

    5. Don't Add the Base64 String field to your report.

    pastedimage1660207163478v5.png

    6. Insert a column and then insert a image. Its setting like this:

    pastedimage1660207326178v6.png

    pastedimage1660207360913v7.png

    Expression: =System.Convert.FromBase64String(Fields!new_longbase64.Value)

    Note:  please change the MiMe type.

    Preview:

    pastedimage1660207491510v8.png

  • EBMRay Profile Picture
    EBMRay 873 on at
    RE: SSRS - Display Image in a report from an Image column Type

    Hello  ,

    I would highly appreciate your support for this issue.

    Thank you!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans