Set query FROM table using report parameter in BIRT

10,668

I just answered this same question over at BIRT Exchange: http://www.birt-exchange.org/forum/designing-birt-reports/19097-set-query-table-using-report-parameter.html#post62590

I should note that the queries MUST return the same fields & data types after you modify them. I only note this because of your statement above that the table structure varies "a bit". It is perfectly safe to modify the FROM or WHERE clauses in a BIRT query, but you cannot modify the actual SELECT construct.

Share:
10,668
Adam Morris
Author by

Adam Morris

By day: I develop the ASGedge cloud platform for specialty retail real estate management. Currently working with a python / flask / backbone.js & bootstrap / Ubuntu / AWS technology stack. By night: I am a social entrepreneur and host of the podcast, People Helping People.

Updated on September 01, 2022

Comments

  • Adam Morris
    Adam Morris over 1 year

    I am using the BIRT report writer, and I have multiple tables with the same data structure. In my report design, I want to select the table my query uses as a report parameter (as part of a mysql query in the data set) -- but I can't figure it out.

    When I create the data set, it's great that I can use parameters in the form of SELECT * FROM WHERE ?, and set these to report parameters, but I get an error if I set the ? to the table, such as:

    SELECT * FROM ? WHERE 1

    Is there another way I can do this? As it's java, I assume the syntax follows that of a PreparedStatement. In BIRT 2.5 there is a property binding option under the data set dialog... and I've tried setting my query as: "SELECT * FROM "+params["DataTable"].value+" WHERE 1", but that was also results in an error.