Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Data set expressions and design element expressions
Data set expressions and design element expressions [message #831919] Thu, 29 March 2012 10:21
Jan Kohnert is currently offline Jan Kohnert
Messages: 192
Registered: July 2009
Senior Member
Hello,

How can I access via API the following information:

1. The query string of all sql data sets within a report?
2. The expression of the design elements?

1:
I need to execute a data sets expression for each report once one gets registered to the report engine to query all returning columns in order to remove them from the reports bindings. (Because sadly BIRT throws exceptions when bindings within a report do not get their data, even when the bindings are never used somewhere....) There for I need to ask the report for its data sets and those data sets for their expression and parameters (I already have the report parameters...)

2:
Currently I've a rather complicated path to access the design elements bindings:
IReportRunnable design = getReportDesign();
Module module = design.getDesignHandle().getModule();
List<DesignElement> allElements = module.getAllElements();
int unusualColumnCounter = 0;

Set<String> legalItems = DBTools.getAllColumnNames();

for (DesignElement designElement : allElements) {
    DesignElementHandle handle = designElement.getHandle(module);
    if (handle instanceof ReportItemHandle || handle instanceof DataItemHandle) {

        // !!!
        if (handle instanceof ReportItemHandle) {
            ReportItemHandle reportItemHandle = (ReportItemHandle) handle;
            Iterator columnBindingsIterator = reportItemHandle.columnBindingsIterator();
            while (columnBindingsIterator.hasNext()) {
                ComputedColumnHandle computedHandle = (ComputedColumnHandle) columnBindingsIterator.next();
                if (computedHandle != null) { // ???
                    String computed = computedHandle.getName();
                    if (!legalItems.contains(computed)) {
                        reportItemHandle.removedColumnBinding(computed);
                        unusualColumnCounter++;
                    }
                }
            }
        }
    }
}


The code removes all bindings from a design that are unknown to the system. (Using removeUnusedColumnBindings() removes bindings from within scripts also and is there for unusable.) Unfortunately the code never returns the expression defined in the expression builder of the BIRT designer. Not even when using the getExpression() method (returns only one binding used....)

The best solution was, if BIRT would not care about missing bindings. Having a 'relaxed binding mode' or if it would insert a 'missing binding' string into the output if it is not available would be just perfect for my needs....

Thank you,
Jan
Previous Topic:Drill through feature issue in UNIX
Next Topic:Set a global variable using report parameter
Goto Forum:
  


Current Time: Fri Aug 29 20:22:26 EDT 2014

Powered by FUDForum. Page generated in 0.01537 seconds