Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Show bitmap into a report

Posted on by 80

Hi all,

I've insert an image for a record as an external notes (using docuRef,  where docuType = File).

Now, I've to display the image (saved as .bmp) into a report.

Into the report I've added a display method (that returns Bitmap) like:

-------------------------------------------------
    DocuRef                 docuRef;
    FileName                fileName;
    Image                   image;
    container               imageCont;
    Bitmap                  ret;
    ;
   
        select docuRef where
            docuRef.RefTableId == tableId &&
            docuRef.RefRecId == recId &&
            docuRef.TypeId == 'FILE';
        fileName = docuRef.completeFilename();
        if (Image::canLoad(fileName))
        {
            image = new Image();
            image.loadFile(fileName);
            imageCont = conIns(imageCont, 1, image.getData());
            ret = conpeek(imageCont, 1);
            return ret;
        } //---- end-if image

---------------------------------------------------

The select statement find out the filePath, the image load the fileName, the container returns a value into ret.... but nothing is displayed in my report!!!

Can someone help me to understand why? Have someone any suggestion?

Thanks to all

Emanuela

 

*This post is locked for comments

  • Emanuela Govoni Profile Picture
    Emanuela Govoni 80 on at
    Re: Show bitmap into a report

    Hi Mohamed

    thank you very much for your answer.

    I solved my problem using image as a table field, instead that as a note. But next time I'll try your suggestion.

    Best regards,

    Emanuela Govoni

  • Re: Show bitmap into a report

    Hello,

    Are you running your report manualy or in batch? Image processing is disabled my Microsoft in batch mode for security. Images can only be printed if reports are printed manualy.

    Use this code :
    display server public DocuValueFile your_method_name() {
    DocuRef docuref;
    DocuValue docuValue;
    ;
    select firstonly tableid from docuRef
    where docuRef.RefCompanyId == dataAreaId &&
    docuRef.RefTableId == tableId &&
    docuRef.RefRecId == recId &&
    docuRef.TypeId == 'FILE'
    join file from docuValue
    where docuValue.RecId == docuRef.ValueRecId;
    return docuValue.File;
    }

    and drag it to the design, it works.

    Best regards,

    Mohamed Amine

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 229,963 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans