Hide a crosstab if empty [message #520769] |
Mon, 15 March 2010 09:39 |
Missing name Missing name Messages: 94 Registered: November 2009 |
Member |
|
|
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 09:41] Report message to a moderator
|
|
|
Re: Hide a crosstab if empty [message #520873 is a reply to message #520769] |
Mon, 15 March 2010 15:57 |
|
Trevor,
It would be good if you could log an enhancement request for this.
As a work around if you are using the frameset mapping or RE API with
separate run and render tasks you could enter the following script on
the xtab:
function onPrepareCrosstab( crosstab, reportContext )
{
importPackage(Packages.java.lang)
reportContext.setPersistentGlobalVariable("displayme", new Integer(0));
}
function onCreateCell( cellInst, reportContext )
{
if( cellInst.getCellType() == "aggregation"){
importPackage(Packages.java.lang);
reportContext.setPersistentGlobalVariable("displayme", new Integer(1));
}
}
function onRenderCrosstab( crosstabInst, reportContext )
{
var dm = parseInt(reportContext.getPersistentGlobalVariable("displayme "));
if( dm == 0 ){
crosstabInst.getStyle().display = "none";
}
}
Jason
TREVOR.HIGGINS@FINEOS.COM wrote:
> 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
> [CODE]
> measure["AMOUNT1"] == null
> /CODE]
>
> This works fine in the designer but when I drop the report into TC
> 6.0.18 I get the following exception:
>
> 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 star
> d.
> at
> org.eclipse.birt.data.engine.olap.script.JSMeasureAccessor.g et(JSMeasureAccessor.java:67)
>
> at
> org.mozilla.javascript.ScriptableObject.getProperty(Scriptab leObject.java:1575)
>
> at
> org.mozilla.javascript.ScriptRuntime.getObjectElem(ScriptRun time.java:1363)
> at
> org.mozilla.javascript.ScriptRuntime.getObjectElem(ScriptRun time.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(ContextFacto ry.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.e valuate(JavascriptEngine.java:256)
>
> at
> org.eclipse.birt.core.script.ScriptContext.evaluate(ScriptCo ntext.java:152)
> at
> org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(ExecutionContext.java:706)
>
> at
> org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(ExecutionContext.java:687)
>
> at
> org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(ExecutionContext.java:664)
>
> at
> org.eclipse.birt.report.engine.data.dte.CubeResultSet.evalua te(CubeResultSet.java:195)
>
> at
> org.eclipse.birt.report.item.crosstab.core.re.executor.Conte ntUtil.processVisibility(ContentUtil.java:220)
>
> at
> org.eclipse.birt.report.item.crosstab.core.re.executor.Conte ntUtil.processVisibility(ContentUtil.java:178)
>
> at
> org.eclipse.birt.report.item.crosstab.core.re.executor.BaseC rosstabExecutor.processVisibility(BaseCrosstabExecutor.java: 162)
>
> at
> org.eclipse.birt.report.item.crosstab.core.re.executor.Cross tabReportItemExecutor.execute(CrosstabReportItemExecutor.jav a:107)
>
> at
> org.eclipse.birt.report.engine.executor.ExtendedItemExecutor .execute(ExtendedItemExecutor.java:62)
>
> at
> org.eclipse.birt.report.engine.internal.executor.wrap.Wrappe dReportItemExecutor.execute(WrappedReportItemExecutor.java:4 6)
>
> at
> org.eclipse.birt.report.engine.internal.executor.emitter.Rep ortItemEmitterExecutor.execute(ReportItemEmitterExecutor.jav a:46)
>
> at
> org.eclipse.birt.report.engine.internal.executor.dup.Suppres sDuplicateItemExecutor.execute(SuppressDuplicateItemExecutor .java:43)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking LM.layoutNodes(HTMLBlockStackingLM.java:65)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.la youtChildren(HTMLStackingLM.java:26)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbstractLM.java:137)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLInlineStackin gLM.resumeLayout(HTMLInlineStackingLM.java:111)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLInlineStackin gLM.layoutNodes(HTMLInlineStackingLM.java:160)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.la youtChildren(HTMLStackingLM.java:26)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbstractLM.java:137)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking LM.layoutNodes(HTMLBlockStackingLM.java:70)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.la youtChildren(HTMLStackingLM.java:26)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layou tChildren(HTMLTableLM.java:132)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.la yout(HTMLAbstractLM.java:137)
>
> at
> org.eclipse.birt.report.engine.layout.html.HTMLBlockStacking LM.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.HTMLReportLayoutE ngine.layout(HTMLReportLayoutEngine.java:99)
>
> at
> org.eclipse.birt.report.engine.presentation.ReportDocumentBu ilder.build(ReportDocumentBuilder.java:258)
>
> at
> org.eclipse.birt.report.engine.api.impl.RunTask.doRun(RunTas k.java:243)
> at
> org.eclipse.birt.report.engine.api.impl.RunTask.run(RunTask. java:82)
> at
> com.fineos.reporting.birt.BirtReportManager.runReport(BirtRe portManager.java:828)
>
> at
> com.fineos.reporting.birt.BIRTReportsProvider.runReport(BIRT ReportsProvider.java:184)
>
> at
> com.fineos.reporting.services.serviceskeleton.ReportingServi cesSkeleton.runReport(ReportingServicesSkeleton.java:171)
>
> at
> com.fineos.reports.operationtypes.ReportingServicesMessageRe ceiverInOut.invokeBusinessLogic(ReportingServicesMessageRece iverInOut.java:16
>
>
> at
> org.apache.axis2.receivers.AbstractInOutMessageReceiver.invo keBusinessLogic(AbstractInOutMessageReceiver.java:40)
>
> at
> org.apache.axis2.receivers.AbstractMessageReceiver.receive(A bstractMessageReceiver.java:100)
>
> at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:1 76)
> at
> org.apache.axis2.transport.http.HTTPTransportUtils.processHT TPPostRequest(HTTPTransportUtils.java:275)
>
> at
> org.apache.axis2.transport.http.AxisServlet.doPost(AxisServl et.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.internalDoFi lter(ApplicationFilterChain.java:290)
>
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(App licationFilterChain.java:206)
>
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(Standar dWrapperValve.java:233)
>
> at
> org.apache.catalina.core.StandardContextValve.invoke(Standar dContextValve.java:191)
>
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHo stValve.java:128)
>
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorRepo rtValve.java:102)
>
> at
> org.apache.catalina.core.StandardEngineValve.invoke(Standard EngineValve.java:109)
>
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAd apter.java:286)
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Proce ssor.java:845)
> at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHand ler.process(Http11Protocol.java:583)
>
> at
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoin t.java:447)
> at java.lang.Thread.run(Thread.java:619)
>
|
|
|
|
Re: Hide a crosstab if empty [message #520904 is a reply to message #520896] |
Mon, 15 March 2010 17:10 |
|
Trevor,
I tried that approach in 2.5.2 and it did not work at all (designer or
deployed). I am not certain why you got the error. Log a bug and
someone on the dev team will have a look. Log it as an enhancement so
we can get the feature requested.
Jason
TREVOR.HIGGINS@FINEOS.COM wrote:
> Cool, thanks for that. I was thinking something similar but couldnt
> quite get it going. Do you know why my original approach fails in TC, so
> I can log a meaningful enhancement request?
|
|
|
|
Re: Hide a crosstab if empty [message #817050 is a reply to message #520873] |
Fri, 09 March 2012 15:21 |
Durga Ravi Santhosh Gurajada Messages: 6 Registered: February 2012 |
Junior Member |
|
|
You can hide the crosstab entirely by using this code.
paste this code snippet at Corsstab's OnCreateCrosstab section
function onCreateCrosstab( crosstabInst, reportContext )
{
if( reportContext.evaluate("dimension['EmpGroup']['NAME']") == null)
{
crosstabInst.getStyle().display="None";
}
}
At the place of "dimension['Emp NameGroup']['VAR_FIRSTNAME']" give a column binding data and change the quotes as shown above.
This will hide the crosstab
[Updated on: Fri, 09 March 2012 15:23] Report message to a moderator
|
|
|
|
Re: Hide a crosstab if empty [message #904621 is a reply to message #904386] |
Tue, 28 August 2012 20:41 |
|
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.03225 seconds