On April 27, 2024, our Sign-in and Create Account options will be unavailable from 9am-12pm ET. During this maintenance window, developer account access and free trial registration will be unavailable.

Switching Data Sets

ericsmith
ericsmith Junior Member
Hopefully a simple question about changing data sets in a report...

I'd like to change from one data set to another with an existing report. I can't figure out how to do this with the various bindings. Each time I've tried to switch, the report starts throwing errors and I have to rebuild from scratch.

For example if a report has a table with a few cell's I assumed I'd just rebind the table to the new data set, then edit the cell's binding data to the new field name - but this doesn't work.

Any suggestions are appreciated.

Comments

  • JasonW
    edited 1969 31 #2
    I have not done this with a chart but you can do it with a table like this:

    In the beforeFactory add script like this (make sure to name your table).

    table = reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("table1");

    ch = table.getColumns().get(0);
    ch.setProperty("width", "10%");
    table.setProperty( "dataSet", "Data Set2" );
  • Virgil
    Virgil Administrator EM admin
    edited 1969 31 #3
    Hi ericsmith,

    This should work as you described. What version of BIRT are you using? I'm using BIRT 2.2 and just created a report design with 2 datasets.

    dataset1 has custnum, name, and city
    and
    dataset2 has custnum, name, and state

    I dropped dataset1 onto the report and previewed to make sure it worked... then selected the table and switched the binding to dataset2. In BIRT 2.2, I can preview this without errors but nothing shows up for city. I then right-clicked on City, selected Change Data Column, and then picked State. After this, it ran fine and showed the State value. You could also delete the city field and drop state from the dataset2 onto the report.

    Virgil
  • ericsmith
    ericsmith Junior Member
    edited 1969 31 #4
    Virgil,

    The right click, select "change data column" worked. Thanks! That process is a little buried, I had tried everything but looking at the right click menu.