Adding a Dynamic Image in BI Publisher Report
To add a dynamic Unifier image in BI Publisher report, we need to create a new data set in the Data Model (XDM) file, as explained below.
Note: The following instructions apply to reports that run directly on BI Publisher server. The BI Publisher reports run via Unifier do not need to make these changes.
In the .XDM file:
<dataSet name="security_token" type="complex">
<sql>
<![CDATA[SELECT token_value sec_token from ( SELECT token_value,expired,ROW_NUMBER() OVER (ORDER BY expired desc) rn FROM sys_server_token WHERE token_type = 'img') where rn = 1]]>
</sql>
</dataSet>
<group name="security_token" label="security_token" source="security_token">
<element name="SEC_TOKEN" value="SEC_TOKEN" label="SEC_TOKEN" dataType="xsd:string" breakOrder="" fieldOrder="1"/>
</group>
Note: The purpose is to get the server token from database where "expired" is the maximum from all the rows.
In the report template that requires to have the image to be inserted, change the "Alt text" of the image to point to image retrieval URL.
To retrieve a Unifier image, use the URL: https://unifier-server-address /bluedoor/rest/image/<image_id>/<server_token>
The report parameter uuu_p_urlF
can be created in Data Model (XDM) file with a default value, so at the runtime the server address-part of the URL can be changed appropriately:
<parameter name="uuu_p_urlF" defaultValue="https://unifier-server-address/bluedoor/rest/image" dataType="xsd:string" rowPlacement="8">
<input label="uuu_p_urlF" size="100"/>
</parameter>
The report template uses this URL in the "Alt text" of the image, as in: url:{concat($uuu_p_urlF,'/',DATA_IMAGE_ID,'/',//security_token/SEC_TOKEN[1])}
Where: uuu_p_urlF
can be the template variable, for example: <?variable@begin:uuu_p_urlF;(.//uuu_p_urlF)[1]?>
The security token, retrieved from DB by the dataset is: //security_token/SEC_TOKEN[1]
The runtime data (image ID) is: DATA_IMAGE_ID
Last Published Friday, February 2, 2024