Thursday, August 1, 2013

Use a custom image in AX - DAX reports

Whenever you want a custom image to be shown in AX reports (Not SSRS reports), just do the following.
  1.  In the Design section of the report, create a BITMAP control.
  2. Create a display method with the code as shown below in the report methods.
  3. Import the external image file into AX as shown below


public display Bitmap Image()
{
   // CustomImageName is the name of the image in the AX resources node after importing
   ResourceNode resNode=SysResource::getResourceNode('CustomImageName');
   container nodeData;
  
   Image img;
  
   if  (resNode != null)
   {
     resNode.AOTload();
     nodeData = SysResource::getResourceNodeData(resNode);
  
     img = new Image(nodeData);
   }
   return img.getData();
}

3. On the DataMethod property of the BITMAP control give the name of the above created display method name. save & compile. Job is DONE!!!!!!





 

No comments:

Post a Comment