Hide a crosstab if empty [message #520769] |
Mon, 15 March 2010 05:39  |
Eclipse User |
|
|
|
Hi,
I want to hide a crosstab if there is no data returned. I'm doing this by setting the visibility in the properties of the crosstab as follows:
In the expression builder I can see the datacube so I pick the summary field and check if its null
measure["AMOUNT1"] == null
This works fine in the designer but when I drop the report into TC 6.0.18 I get the exception below:
Can anyone help with what is causing it, or offer a different method of hiding the crosstab when datacube is empty?
thanks
java.lang.RuntimeException: org.eclipse.birt.data.engine.core.DataException: The level member cannot be achieved because the result set has not
started.
at org.eclipse.birt.data.engine.olap.script.JSMeasureAccessor.get(JSMeasureAccessor.java:67)
at org.mozilla.javascript.ScriptableObject.getProperty(ScriptableObject.java:1575)
at org.mozilla.javascript.ScriptRuntime.getObjectElem(ScriptRuntime.java:1363)
at org.mozilla.javascript.ScriptRuntime.getObjectElem(ScriptRuntime.java:1345)
at org.mozilla.javascript.gen.c78._c0(<inline>:1)
at org.mozilla.javascript.gen.c78.call(<inline>)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:401)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3003)
at org.mozilla.javascript.gen.c78.call(<inline>)
at org.mozilla.javascript.gen.c78.exec(<inline>)
at org.eclipse.birt.report.engine.javascript.JavascriptEngine.evaluate(JavascriptEngine.java:256)
at org.eclipse.birt.core.script.ScriptContext.evaluate(ScriptContext.java:152)
at org.eclipse.birt.report.engine.executor.ExecutionContext.evaluate(ExecutionContext.java:706)
at org.eclipse.birt.report.engine.executor.ExecutionContext.evaluate(ExecutionContext.java:687)
at org.eclipse.birt.report.engine.executor.ExecutionContext.evaluate(ExecutionContext.java:664)
at org.eclipse.birt.report.engine.data.dte.CubeResultSet.evaluate(CubeResultSet.java:195)
at org.eclipse.birt.report.item.crosstab.core.re.executor.ContentUtil.processVisibility(ContentUtil.java:220)
at org.eclipse.birt.report.item.crosstab.core.re.executor.ContentUtil.processVisibility(ContentUtil.java:178)
at org.eclipse.birt.report.item.crosstab.core.re.executor.BaseCrosstabExecutor.processVisibility(BaseCrosstabExecutor.java:162)
at org.eclipse.birt.report.item.crosstab.core.re.executor.CrosstabReportItemExecutor.execute(CrosstabReportItemExecutor.java:107)
at org.eclipse.birt.report.engine.executor.ExtendedItemExecutor.execute(ExtendedItemExecutor.java:62)
at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.execute(WrappedReportItemExecutor.java:46)
at org.eclipse.birt.report.engine.internal.executor.emitter.ReportItemEmitterExecutor.execute(ReportItemEmitterExecutor.java:46)
at org.eclipse.birt.report.engine.internal.executor.dup.SuppressDuplicateItemExecutor.execute(SuppressDuplicateItemExecutor.java:43)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:65)
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:137)
at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.resumeLayout(HTMLInlineStackingLM.java:111)
at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.layoutNodes(HTMLInlineStackingLM.java:160)
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:137)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
at org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layoutChildren(HTMLTableLM.java:132)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:137)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:90)
at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:99)
at org.eclipse.birt.report.engine.presentation.ReportDocumentBuilder.build(ReportDocumentBuilder.java:258)
at org.eclipse.birt.report.engine.api.impl.RunTask.doRun(RunTask.java:243)
at org.eclipse.birt.report.engine.api.impl.RunTask.run(RunTask.java:82)
at com.fineos.reporting.birt.BirtReportManager.runReport(BirtReportManager.java:828)
at com.fineos.reporting.birt.BIRTReportsProvider.runReport(BIRTReportsProvider.java:184)
at com.fineos.reporting.services.serviceskeleton.ReportingServicesSkeleton.runReport(ReportingServicesSkeleton.java:171)
at com.fineos.reports.operationtypes.ReportingServicesMessageReceiverInOut.invokeBusinessLogic(ReportingServicesMessageReceiverInOut.java:16
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:100)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:131)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
[Updated on: Mon, 15 March 2010 05:41] by Moderator
|
|
|
|
|
|
|
|
|
Re: Hide a crosstab if empty [message #904621 is a reply to message #904386] |
Tue, 28 August 2012 16:41  |
Eclipse User |
|
|
|
Paul
Where did you put the script and how did you check for null?
function onCreateCrosstab( crosstabInst, reportContext )
{
if( reportContext.evaluate("dimension['DispenserGroup']") == null)
{
crosstabInst.getStyle().display="None";
}
}
You could change one of the labels to say no data or you could set a
global variable in your visibility expression like:
if( data["quantity1"] == null ){
reportContext.setGlobalVariable("crosstabHide", true);
}else{
reportContext.setGlobalVariable("crosstabHide", false);
}
data["quantity1"] == null
You could then add a label to the report that says No Data and set a
visibility expression on it using:
reportContext.getGlobalVariable("crosstabHide");
For more on crosstab scripting have a look at:
http://birtworld.blogspot.com/2010/02/birt-crosstab-scripting.html
Jason
On 8/28/2012 7:02 AM, Paul Cockerill wrote:
> Hi. I am new to BIRT and I am unable to get the above script to work.
>
> I have a crosstab that I wish to hide if empty or ideally display a
> message such as "no results for ......"
>
> My cube is called Dispensers, with a Dimension called DispenserGroup
> that contains fields partid and partdesc. My Measure is called quantity
> with the field quantity1.
>
> I am able to hide the crosstab using the visibility expression builder
> with data["quantity1"] == null.
>
> I thought by using the script you mention above I would be able to have
> statement to add in my " no results for......." message, however I am
> falling at the first hurdle and unable to hide the crosstab!!.
>
> Regard's
> Paul
>
|
|
|
Powered by
FUDForum. Page generated in 0.04716 seconds