javasqlreportbirt

BIRT 4.8 REPORT WRITER - Change title in Master Page header depending on data


I am trying to update one of our company documents. In the master page header i want the title of the document to show "Proforma" if a certain bit of data is true and "Quotation" if not.

Using scripts in the OnCreate of the header row (where i have a number of variables that work in the header perfectly fine) I have:

// Default set global variable
function setVariable(columnName, variableName) {
    var value = this.getRowData().getColumnValue(columnName);
    if (value != null) {
        reportContext.setGlobalVariable(variableName,value.toString());
    } else {
        reportContext.setGlobalVariable(variableName,"");
    }
}

// Set Page Title
if (parseString(this.getRowData().getColumnValue("source")) == "Proforma") {
    reportContext.setGlobalVariable("Proforma","Source");
} else {
    reportContext.setGlobalVariable("Quotation","Source");
}

and in the report design onPageEnd i have:

reportContext.setPageVariable("SOURCE", reportContext.getglobalVariable("Source"));

I have put this page variable into the location i want it to show, i get no errors but it doesnt print to screen when the report is run...what am i missing?

Thanks in advance.

Everything i have tried is in the detail above.


Solution

  • If the title depends on the data, but is the same for all pages (e.g., not a "group title"), then the easiest way is to bind a grid in the master page header to a corresponding data set.