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)
how to access LinkedHashMap in scripting
Vishnupriya
<p>hi,</p><p> </p><p>I'm trying to access a LinkedHashMap in report beforeFactory event thro' rhino scripting..Able to print the map. But, when i use any method like size(), the following error is thrown</p><p>[color=#ff0000;]<strong>size not found</strong>[/color]</p><p> <br />
var test1 = reportVO.getTest(); // "test" is a LinkedHashMap<br />
log(test1) // --> In the logs, im able to see the LinkedHashMap contants printed<br />
(log test1.size()) // --> this fails.</p><p> </p><p> <br />
I read about org.eclipse.birt.core.script.NativeJavaLinkedHashMap. I tried accessing the LinkedHashMap thro' methods of this class also, like</p><p> </p><p>test1.getIds() // Method from NativeJavaLinkedHashMap --> this fails too<br />
</p><p> <strong>[color=#ff0000;]getIds not found[/color]</strong><br />
<br />
I have imported the util package and org.eclipse.birt.core.script</p><p> Is there a specific way to access LinkedhashMap in script.<br />
<br />
<br />
Thanks,<br />
Vishnupriya</p>
Find more posts tagged with
Comments
kclark
<p>To use a LinkedHashmap you'd need to either import the package or do something like</p><pre class="_prettyXprint">var lhm = new java.util.LinkedHashMap();</pre><p>You can test this in the onCreate() of a label with something like</p><pre class="_prettyXprint _lang-">var lhm = new java.util.LinkedHashMap(); lhm.put("Test1", new java.lang.Double(12.34)); lhm.put("Test2", new java.lang.Double(14.53));this.text = lhm.size();</pre>