Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Error in computing the chart report viewer frameset vs. run
Davolio
Alright I have this report if I run it on the viewer with the run or preview it works, and if I run it using the frameset I get this error.
NOTE these ports were created and run using BIRT 2.2.1
works:
localhost:8383/birt/run?__report=EnterpriseEffectiveness.rptdesign
doesn't:
localhost:8383/birt/frameset?__report=EnterpriseEffectiveness.rptdesign
here's the error I get:
Chart MyChart:
- TypeError: Cannot read property "length" from null at line 133 of chart script:''
Here's the part of the script with the error:
Now what this script does is grab an array of Warehouse id's and keys that I've created and saved as a persistent global variable. I want to be able to access them in the chart to to iterate through and add in the correct label name for the chart values.
function beforeDrawLegendItem(lerh, bounds, icsc)
{
var whseIdArray = icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("whseIdArray");
var whseKeyArray = icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("whseKeyArray");
//we can cheat because we KNOW that both of these arrays are the same size..
//iterate through the values if we find a match we assign the display...
//filled because this is a REQUIRED parameter so ;D
//error here:
for (var counter=0;counter<whseIdArray.length;counter++)
{
var currCaptionVal = lerh.getLabel().getCaption().getValue();
var currWhseId = whseIdArray[counter] +'';
var currWhseKey = whseKeyArray[counter] +'';
if( currCaptionVal == currWhseKey)
{
lerh.getLabel().getCaption().setValue(currWhseId);
}
}
}
Is my global variable getting borked somewhere? I dont' know why it runs in preview and run but not frameset....
Anyways If anyone know the answer or knows a better way to get a list of values into the chart via the getExternalContext(), I would greatly appreciate it.
Thanks,
Dave
Find more posts tagged with
Comments
Davolio
I think the error is that my getExternalContext doesn't work on when I run the frameset, because I tried passing in the list a completely different way (through a delimited string) and my string was treated as null. My PersistantGlobalVariables are not working correctly when using the
icsc.getExternalContext()
Maybe the external context isn't the context I should be using?
Any ideas?
Thanks,
Dave
Davolio
Maybe this is a frameset vs run issue; however I have them configured the same (I think). I'm using a JBOSS 4.2.3 server.
<!-- Viewer Servlet Context Listener -->
<listener>
<listener-class>org.eclipse.birt.report.listener.ViewerServletContextListener</listener-class>
</listener>
<!-- Viewer HttpSession Listener -->
<listener>
<listener-class>org.eclipse.birt.report.listener.ViewerHttpSessionListener</listener-class>
</listener>
<!-- Viewer Servlet, Support SOAP -->
<servlet>
<servlet-name>ViewerServlet</servlet-name>
<servlet-class>org.eclipse.birt.report.servlet.ViewerServlet</servlet-class>
</servlet>
<!-- Engine Serlvet -->
<servlet>
<servlet-name>EngineServlet</servlet-name>
<servlet-class>org.eclipse.birt.report.servlet.BirtEngineServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ViewerServlet</servlet-name>
<url-pattern>/frameset</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>ViewerServlet</servlet-name>
<url-pattern>/run</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>EngineServlet</servlet-name>
<url-pattern>/preview</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>EngineServlet</servlet-name>
<url-pattern>/download</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>EngineServlet</servlet-name>
<url-pattern>/parameter</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>EngineServlet</servlet-name>
<url-pattern>/document</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>EngineServlet</servlet-name>
<url-pattern>/output</url-pattern>
</servlet-mapping>
<taglib>
<taglib-uri>/birt.tld</taglib-uri>
<taglib-location>/WEB-INF/tlds/birt.tld</taglib-location>
</taglib>
Davolio
hrrmmm where I assign the variable is causing the issue:
I'm doing one of these in my onFetch()
//onFetch
whseIdArray = reportContext.getPersistentGlobalVariable("whseIdArray");
whseKeyArray = reportContext.getPersistentGlobalVariable("whseKeyArray");
whseIdArray = whseIdArray + row["whse_id"] + ":-;";
whseKeyArray = whseKeyArray + row["whse_key"] + ":-;";
reportContext.setPersistentGlobalVariable("whseIdArray",whseIdArray);
reportContext.setPersistentGlobalVariable("whseKeyArray",whseKeyArray);
apparently.... that's not how you're supposed to do things... so currently finding a workaround for the above and that should solve my problem. Instead of peeling out the values onFetch I'll probably have to grab them from a table or something.
Davolio
Ok..
Apparently if you want to use the frameset viewer then you cannot use the OnFetch() of your datasets to set global variables. Note this works on run and preview versions.
However you can assign those values to a hidden table and then assign the globals while the rows of that table are being filled.
I don't really know if that's the coolest thing in the world or not but whatever.... Thats a day of my life I'll never get back but at least I learned something
Later,
Dave
java032
I have the same problem with you about frameset and run , I can't get the parameters for parameterpage tag .
I think this is a same problem.
Do you solve this problem ?
please give me a hint.
thank you .