Dinamic title in Birt report

Hi Guys,
i’m new in KNIME world. I’m traing to make a BIRT report, but i want that the title is a variable, that i read from xls file.

I use this script:

function beforeGeneration( chart, icsc )
{
chart.getTitle().getLabel().getCaption().setValue(variablename);

}
and it is working when i change variablename with “Title”, that is static string, but how i can call variable?
I’m using in workflow java edit variable to send variable to data to report, is it correct?

Thanks.
Biagio

Hello @Biagio,

First of all: Welcome to KNIME.

I’m not sure whether I understand your use case and problem correctly.
A BIRT report report is connected to a KNIME workflow and the data is handed over using the https://nodepit.com/node/com.knime.reporting.nodes.dataset.ReportingDataSetNodeFactory node.
In the BIRT report you can use data from several data-to-report nodes.
So it should be very easy for you to create the title in the workflow, hand it over to BIRT and use it there.

Maybe you can give more details and share an example of your required result?
That would help to understand your issue and give precise hints

1 Like

Hi Knimediger,
i think that i don’t was able to explicate my problem. I’m sending an exemple.

immagine

I made this workflow where i read data from xls, the first flow is necessary because i need read the chart title from the file and i convert it an variable (i think that is correct…), in the second flow i read the data.
I’m able to generate a chart in birt like added…


but i want that de chart title which is marked in red is dinamicaly from the variable that i read with the first workflow…is it possible?

I’m using this javascript befor generate a report:

function beforeGeneration( chart, icsc )
{
chart.getTitle().getLabel().getCaption().setValue(variablename);

}
but i’m no able call the variable that i read with the firt workflow…do you understand my problem?

1 Like

Well, I’ve never tried to use a flow variable as input to the BIRT report.

So I would solve your issue in this way: I assume that the output of the first line is just the report title. So put this into a second data to report node.
The content of that node can be used as input for the chart title.

HTH

Isn’t work…or better i think that is no working…because i don’t know how i can use the data from the second data to report node in chart title…

Biagio

I was able to work only with one data sete (only with one data to report node) with this

reportContext.setPersistentGlobalVariable(“charttitle”, row[“Row5”]); working onfetch,

but now i have just one problem…it’s working when the data set in 1x1 (only the chart title), but i have a dat set in 100 line x 200 column…
The point is, there is a comand like row["Row5’] that can go directly on the cell that i need?

thanks

Biagio

You should be able able to see and select the second datasource in BIRT.
In case you do not see it it may help to close the BIRT report, save the KNIME workflow and open the report then. It should ask whether to update interface information.

As mentioned before, I just know one way to solve your problem. I’m sorry to say that I’m not aware of a solution for this approach.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.