Monday, September 9, 2013

Dynamic Images in XML Publisher

Image path used in XML publisher can be constructed dynamically from values rather than hard coding. Below image provides the example.

CF_IMAGE_NAME in the report generates image name value for each row of data. And the images with those names reside in the path "$OA_MEDIA/custom/". Let's say a value of CF_IMAGE_NAME is image1.jpg during run time the follow value will be rendered to "$OA_MEDIA/custom/image1.jpg" and the corresponding image will be displayed on the output.

Format picture is a property of a dummy image used in the report to print the images in specific dimension. Due to white background its not visible. You can check more from other post.



There are times when a custom application server path has to be used instead of $OA_MEDIA.
In order to use a custom application path, derive the full path to image in the XML element along with
image name or different element for image name and use it in the XML template.




And use the elements in the image properties ALT TEXT. Below word properties are from Office 2013.
Note that data structure has  elements in root hence the construction of the concat is

url:{concat(IMAGE_PATH,'/',IMAGE_NAME)}






To bring up and use the XML elements at a different level use ../ or // in the concat

url:{concat(../IMAGE_PATH,'/',../IMAGE_NAME)}

No comments:

Post a Comment