On page footer, I need to display a image with a set of data on the basis of data that I received from data set. But the data in the image will change on different pages.
For example I got 8 number of data from data set (rest API data set) and I need to display 6 data in image on 1st page and rest 2 data on 2nd page.
I have written script on image render event on the basis of page number to pass the data and on layout I have taken a table at the last of all content with page break interval=1. This script is working if page content is coming in one page. But the issue is coming when the page content is displaying in more that one page. Because I can not add page break in between of my content so page number variable is not being updated. So the first two pages are displaying the same data in image and then data changes on the third page.
Script on image render:
var b_params = "";
var LBL_STRING = reportContext.getPersistentGlobalVariable("LABELS");
var sp_count = parseInt(pageNumber - 1) * 6 + 0;
var labels_array = LBL_STRING.split("~");
var nLABEL = reportContext.getPersistentGlobalVariable("NLABELS");
if (nLABEL > 0 ) {
var spc =(labels_array[sp_count] && labels_array[sp_count] != null) ? labels_array[sp_count] : "";
b_params += '&sp1='+ encodeURI(spc.split('&').join('amp;'));
sp_count++;
var spc =(labels_array[sp_count] && labels_array[sp_count] != null) ? labels_array[sp_count] : "";
b_params += '&sp2='+ encodeURI(spc.split('&').join('amp;'));
sp_count++;
var spc =(labels_array[sp_count] && labels_array[sp_count] != null) ? labels_array[sp_count] : "";
b_params += '&sp3='+ encodeURI(spc.split('&').join('amp;'));
sp_count++;
var spc =(labels_array[sp_count] && labels_array[sp_count] != null) ? labels_array[sp_count] : "";
b_params += '&sp4='+ encodeURI(spc.split('&').join('amp;'));
sp_count++;
var spc =(labels_array[sp_count] && labels_array[sp_count] != null) ? labels_array[sp_count] : "";
b_params += '&sp5='+ encodeURI(spc.split('&').join('amp;'));
sp_count++;
var spc =(labels_array[sp_count] && labels_array[sp_count] != null) ? labels_array[sp_count] : "";
b_params += '&sp6='+ encodeURI(spc.split('&').join('amp;'));
sp_count++;
}
var host_url = params["host"].value;
var img_url = "";
var img ="/reqprn/frm/birt/label/birt_ucmc_label.php?" + b_params;
img_url= "
http://"+vars["ServerPath"]+ img;
this.URI = img_url;