Monday, January 18, 2016

Reading images and displaying on report

To display images on a SSRS report in AX we can use below code.

Sometimes we need to show images on SSRS reports, for that purpose we can use below code to fetch the image from a table field as assign to the TmpTable used in SSRS report.

Replace <Table.Field> with your  table name and field name

imagePath = conPeek(PackingSlipReportDP::findMatchingFiles(<Table.Field>,'*.jpg*'),1);
            new FileIOPermission(imagePath,'r').assert();
            if ( WinAPI::fileExists(imagePath))
            {
                binData.loadFile(imagePath);
                logoContainer = binData.getData();
           
                <Table.Field>= logoContainer;
            }
            CodeAccessPermission::revertAssert();