Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
AW: AW: [birt-dev] Howto Access Java Objects for a Chart or Table

Hi,
I found the reason for this error... I've not included all the necessary plug-ins.
Here is the dependency-list I'va addedto make it work (I do not know if all of them are necessary)

Require-Bundle: org.eclipse.core.runtime,
 org.eclipse.ui,
 org.eclipse.birt.core,
 org.eclipse.birt.report.runtime,
 org.eclipse.birt.report.viewer,
 org.eclipse.birt.report.engine,
 org.eclipse.birt.report.engine.emitter.html,
 org.eclipse.birt.report.engine.emitter.pdf,
 org.eclipse.birt.chart,
 org.eclipse.birt.chart.reportitem,
 org.eclipse.birt.chart.runtime,
 org.eclipse.birt.data,
 org.eclipse.birt.chart.engine,
 org.eclipse.birt.report.model.adapter.oda,
 org.eclipse.birt,
 org.eclipse.birt.chart.device.extension,
 org.eclipse.birt.chart.device.pdf,
 org.eclipse.birt.chart.device.svg,
 org.eclipse.birt.chart.device.swt,
 org.eclipse.birt.chart.engine.extension,
 org.eclipse.birt.chart.ui,
 org.eclipse.birt.chart.ui.extension,
 org.eclipse.birt.core.ui,
 org.apache.commons.codec,
 com.ibm.icu.source

hf
Hannes

----- Ursprüngliche Mail ----
Von: Hannes Tribus <hannes_tribus@xxxxxxxx>
An: For developers on the BIRT project <birt-dev@xxxxxxxxxxx>
Gesendet: Mittwoch, den 21. Mai 2008, 10:20:34 Uhr
Betreff: AW: [birt-dev] Howto Access Java Objects for a Chart or Table

Hi,
now I'm able to access JavaObjects out of the Scripting DataSource, but I got another error when I try to addit into the Report.
(ECLIPSE-ENV) Could not find dsp impl for org.eclipse.birt.chart.model.type.impl.LineSeriesImpl
or if i try the PieChart it is the same but with
(ECLIPSE-ENV) Could not find dsp impl for org.eclipse.birt.chart.model.type.impl.PieSeriesImpl

I do not understand this logging message.

----- Ursprüngliche Mail ----
Von: Hannes Tribus <hannes_tribus@xxxxxxxx>
An: birt-dev@xxxxxxxxxxx
Gesendet: Dienstag, den 20. Mai 2008, 22:21:00 Uhr
Betreff: [birt-dev] Howto Access Java Objects for a Chart or Table

Hi,
i took the example I found in the Mailinglist added by Markus Schlautmann, but I'm not able to call methods from the Java Object "dataProvider".
I've registered it in the ContextMap, but the ScriptSource is not able to find it.
Do I have to copy the Class-file into the WEB-INF folder?

Thx
Hannes

design = engine.openReportDesign(designHandle);
            IRunAndRenderTask task = engine.createRunAndRenderTask(design);
            RenderOption renderContext = new RenderOption();

            HashMap<String, Object> contextMap = new HashMap<String, Object>();
            IRenderOption options;
            if (output == "html") {
                contextMap.put(EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT, renderContext);
                contextMap.put("dataProvider", CreateReportEngine._dp);
                options = new HTMLRenderOption();

                ((HTMLRenderOption) options).setImageDirectory("output/image");
                ((HTMLRenderOption) options).setHtmlPagination(false);
                ((HTMLRenderOption) options).setHtmlRtLFlag(false);
                ((HTMLRenderOption) options).setEmbeddable(false);

                options.setOutputFormat(PDFRenderOption.OUTPUT_FORMAT_HTML);
            } else {
                contextMap.put(EngineConstants.APPCONTEXT_PDF_RENDER_CONTEXT, renderContext);
                contextMap.put("dataProvider", CreateReportEngine._dp);
                options = new PDFRenderOption();
                options.setSupportedImageFormats("PNG;GIF;JPG;BMP");
                options.setOption(IPDFRenderOption.FIT_TO_PAGE, new Boolean(true));
                options.setOption(IPDFRenderOption.PAGEBREAK_PAGINATION_ONLY, new Boolean(true));
                options.setOutputFormat(PDFRenderOption.OUTPUT_FORMAT_PDF);
                if (file == null) {
                    return null;
                }

            }
            if (file != null) {
                options.setOutputFileName(file.getAbsolutePath());
            }
            task.setAppContext(contextMap);
            // options.setOutputFormat(output);
            options.setOutputStream(bos);
            task.setRenderOption(options);

            // run the report and destroy the engine
            task.run();
            task.close();
            engine.destroy();

The ErrorMessage in the Log
WARNUNG: A BIRT exception occurred: Error evaluating _javascript_ _expression_. Script engine error: TypeError: Cannot call method "getyValues" of null (DataSet[ds].__bm_OPEN#2)
 Script source: DataSet[ds].__bm_OPEN, line: 1, text:
__bm_OPEN(). See next exception for more information.
Error evaluating _javascript_ _expression_. Script engine error: TypeError: Cannot call method "getyValues" of null (DataSet[ds].__bm_OPEN#2)
 Script source: DataSet[ds].__bm_OPEN, line: 1, text:
__bm_OPEN()
org.eclipse.birt.data.engine.core.DataException: A BIRT exception occurred: Error evaluating _javascript_ _expression_. Script engine error: TypeError: Cannot call method "getyValues" of null (DataSet[ds].__bm_OPEN#2)
 Script source: DataSet[ds].__bm_OPEN, line: 1, text:
__bm_OPEN(). See next exception for more information.
Error evaluating _javascript_ _expression_. Script engine error: TypeError: Cannot call method "getyValues" of null (DataSet[ds].__bm_OPEN#2)
 Script source: DataSet[ds]...

The Source:
void buildDataSet(DataProviderChart dataProvider) {
        try {
            System.out.println("starting buildDataSet() method");

            ScriptDataSetHandle dsHandle = _efactory.newScriptDataSet("ds");
            dsHandle.setDataSource("Data Source");
                   
            dsHandle.setOpen("var dataProvider=reportContext.getAppContext().get(\"dataProvider\");"
                    + "data = "" \n"
                    + "data2 = dataProvider.getxValues(); \n "
                    + "totalrows = data.size(); \n" + "currentrow = 1;\n");

            dsHandle.setFetch("if(currentrow >= totalrows) \n" + "{return(false);} \n" + "var favrow = data.get(currentrow); \n" + "row[\"abc0\"] = favrow; \n" + "var favrow2 = data2.get(currentrow); \n" + "row[\"cba0\"] = favrow2 \n;" + "currentrow = currentrow + 1; \n" + "return(true); \n");

            dsHandle.setClose("data = "" \n data2 = null; \n");

            PropertyHandle computedSet = dsHandle.getPropertyHandle(ScriptDataSetHandle.RESULT_SET_PROP);
            ResultSetColumn resultColumn = StructureFactory.createResultSetColumn();

            resultColumn = StructureFactory.createResultSetColumn();
            resultColumn.setPosition(1);
            resultColumn.setColumnName("abc0");
            resultColumn.setDataType("float");
            computedSet.addItem(resultColumn);

            resultColumn = StructureFactory.createResultSetColumn();
            resultColumn.setPosition(2);
            resultColumn.setColumnName("cba0");
            resultColumn.setDataType("string");
            computedSet.addItem(resultColumn);

            _design.getDataSets().add(dsHandle);

            System.out.println("Finished buildDataSet() method");
            System.out.println("");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }




Gesendet von Yahoo! Mail.
Dem pfiffigeren Posteingang.


Gesendet von Yahoo! Mail.
Dem pfiffigeren Posteingang.


Gesendet von Yahoo! Mail.
Dem pfiffigeren Posteingang.

Back to the top