Birt报告中的嵌套案例

时间:2014-03-18 09:53:28

标签: sql birt

如何在Birt报告中使用嵌套案例。 以下查询工作正常,具有单例。

SELECT RD_DEVT.RDT_ORDERDETAIL.ACTIONSTATUS, RD_DEVT.RDT_ORDERDETAIL.REFLINENUM AS REFLINENUM,
  (CASE
   WHEN RD_DEVT.RDT_ORDERDETAIL.ACTIONSTATUS IN (8) THEN 1
   WHEN RD_DEVT.RDT_ORDERDETAIL.ACTIONSTATUS IN (6) THEN 2
   ELSE 5
 END) AS ASTATUS
  FROM RD_DEVT.RDT_ORDER, RD_DEVT.RDT_ORDERDETAIL
  WHERE RD_DEVT.RDT_ORDER.ID = ? AND RD_DEVT.RDT_ORDER.ID = RD_DEVT.RDT_ORDERDETAIL.ORDID
    AND RD_DEVT.RDT_ORDERDETAIL.LATEST = 1
  ORDER BY ASTATUS, REFLINENUM

但是下面的查询会在Birt报告中抛出异常,这有多种情况。

SELECT RD_DEVT.RDT_ORDERDETAIL.ACTIONSTATUS, RD_DEVT.RDT_ORDERDETAIL.REFLINENUM AS REFLINENUM,
  (
  CASE WHEN 'Buyer' = ? THEN
  (CASE
   WHEN RD_DEVT.RDT_ORDERDETAIL.ACTIONSTATUS IN (3) THEN 1
   WHEN RD_DEVT.RDT_ORDERDETAIL.ACTIONSTATUS IN (4) THEN 2
   ELSE 3
   END)
  ELSE 
   (CASE
   WHEN RD_DEVT.RDT_ORDERDETAIL.ACTIONSTATUS IN (8) THEN 1
   WHEN RD_DEVT.RDT_ORDERDETAIL.ACTIONSTATUS IN (6) THEN 2
   ELSE 5
   END)END

 ) AS ASTATUS
  FROM RD_DEVT.RDT_ORDER, RD_DEVT.RDT_ORDERDETAIL
  WHERE RD_DEVT.RDT_ORDER.ID = ? AND RD_DEVT.RDT_ORDER.ID = RD_DEVT.RDT_ORDERDETAIL.ORDID
    AND RD_DEVT.RDT_ORDERDETAIL.LATEST = 1
  ORDER BY ASTATUS, REFLINENUM

如果我尝试保存Above Query,则会显示NullPointerException 它不会像 SQL选择查询之类的输出列,计算列

但如果我改变条件,例如'买方' =''它有效。

例外:

java.lang.NullPointerException
    at org.eclipse.datatools.modelbase.sql.query.helper.DataTypeHelper.getJDBCTypeForNamedType(DataTypeHelper.java:92)
    at org.eclipse.birt.report.data.oda.jdbc.dbprofile.ui.internal.sqb.SQLQueryUtility.getJDBCTypeCode(SQLQueryUtility.java:543)
    at org.eclipse.birt.report.data.oda.jdbc.dbprofile.ui.internal.sqb.SQLQueryUtility.convertToDataElementAttributes(SQLQueryUtility.java:509)
    at org.eclipse.birt.report.data.oda.jdbc.dbprofile.ui.internal.sqb.SQLQueryUtility.updateParameterDesign(SQLQueryUtility.java:468)
    at org.eclipse.birt.report.data.oda.jdbc.dbprofile.ui.internal.sqb.SQLQueryUtility.updateQueryMetaData(SQLQueryUtility.java:182)
    at org.eclipse.birt.report.data.oda.jdbc.dbprofile.ui.internal.sqb.SQLQueryUtility.updateDataSetDesign(SQLQueryUtility.java:106)
    at org.eclipse.birt.report.data.oda.jdbc.dbprofile.ui.internal.sqb.SQBDataSetWizardPage.collectDataSetDesign(SQBDataSetWizardPage.java:394)
    at org.eclipse.datatools.connectivity.oda.design.internal.ui.DataSetWizardPageCore.finishDataSetDesign(DataSetWizardPageCore.java:395)
    at org.eclipse.datatools.connectivity.oda.design.internal.ui.DataSetWizardBase.collectDataSetDesignFromPage(DataSetWizardBase.java:365)
    at org.eclipse.datatools.connectivity.oda.design.internal.ui.DataSetWizardBase.finishDataSetDesign(DataSetWizardBase.java:387)
    at org.eclipse.datatools.connectivity.oda.design.internal.ui.DataSetWizardBase.getResponseSession(DataSetWizardBase.java:123)
    at org.eclipse.datatools.connectivity.oda.design.internal.designsession.DataSetDesignSessionBase.finishDataSetDesign(DataSetDesignSessionBase.java:442)
    at org.eclipse.datatools.connectivity.oda.design.internal.designsession.DataSetDesignSessionBase.flush(DataSetDesignSessionBase.java:237)
    at org.eclipse.datatools.connectivity.oda.design.ui.designsession.DataSetDesignSession.flush(DataSetDesignSession.java:136)
    at org.eclipse.birt.report.designer.data.ui.dataset.PropertyPageWrapper.canLeave(PropertyPageWrapper.java:118)
    at org.eclipse.birt.report.designer.data.ui.dataset.PropertyPageWrapper.performOk(PropertyPageWrapper.java:95)
    at org.eclipse.birt.report.designer.data.ui.property.AbstractPropertyDialog.okPressed(AbstractPropertyDialog.java:771)
    at org.eclipse.birt.report.designer.data.ui.property.AbstractPropertyDialog.okPressed(AbstractPropertyDialog.java:756)
    at org.eclipse.birt.report.designer.data.ui.dataset.DataSetEditor.okPressed(DataSetEditor.java:680)
    at org.eclipse.birt.report.designer.data.ui.property.AbstractPropertyDialog.buttonPressed(AbstractPropertyDialog.java:637)
    at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:228)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3910)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3503)
    at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
    at org.eclipse.jface.window.Window.open(Window.java:801)
    at org.eclipse.birt.report.designer.ui.dialogs.BaseDialog.open(BaseDialog.java:110)
    at org.eclipse.birt.report.designer.data.ui.providers.EditableDataSetNodeProvider.performEdit(EditableDataSetNodeProvider.java:99)
    at org.eclipse.birt.report.designer.internal.ui.views.DefaultNodeProvider.performRequest(DefaultNodeProvider.java:432)
    at org.eclipse.birt.report.designer.internal.ui.views.actions.EditAction.doAction(EditAction.java:90)
    at org.eclipse.birt.report.designer.internal.ui.views.actions.AbstractElementAction.run(AbstractElementAction.java:70)
    at org.eclipse.birt.report.designer.internal.ui.views.RenameListener.doubleClick(RenameListener.java:214)
    at org.eclipse.jface.viewers.StructuredViewer$1.run(StructuredViewer.java:821)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.runtime.Platform.run(Platform.java:888)
    at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:48)
    at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
    at org.eclipse.jface.viewers.StructuredViewer.fireDoubleClick(StructuredViewer.java:819)
    at org.eclipse.jface.viewers.AbstractTreeViewer.handleDoubleSelect(AbstractTreeViewer.java:1419)
    at org.eclipse.jface.viewers.StructuredViewer$4.widgetDefaultSelected(StructuredViewer.java:1195)
    at org.eclipse.jface.util.OpenStrategy.fireDefaultSelectionEvent(OpenStrategy.java:238)
    at org.eclipse.jface.util.OpenStrategy.access$0(OpenStrategy.java:235)
    at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:296)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3910)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3503)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1311)

0 个答案:

没有答案