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)
Unable to pass HashMap to dataset in scripted datasource
Sphatan
Hi I am new to Brrt Reports.<br />
<br />
I am using Birt 2.6 in eclipse Helios.<br />
I am trying to pass a Hasp Map to a scripted data set.<br />
<br />
<strong class='bbc'><span class='bbc_underline'>MapDAo.java:</span></strong><br />
<br />
package Test;<br />
<br />
public class MapDao {<br />
<br />
public MapReport getReportVO(String string) {<br />
MapReport map = new MapReport();<br />
map.addMapReport("identity.FirstName", "Julie");<br />
map.addMapReport("identity.LastName", "Chan");<br />
<br />
return map;<br />
}<br />
}<br />
<br />
<strong class='bbc'><span class='bbc_underline'>My Bean Class-MapReport .java</span></strong><br />
<br />
package Test;<br />
<br />
import java.util.HashMap;<br />
import java.util.Map;<br />
<br />
public class MapReport {<br />
<br />
<br />
<br />
private Map<String, Object> mapReport = new HashMap<String, Object>();<br />
<br />
public Map<String, Object> getMapReport() {<br />
return mapReport;<br />
}<br />
<br />
public void setMapReport(Map<String, Object> mapReport) {<br />
this.mapReport = mapReport;<br />
}<br />
<br />
public void addMapReport(String mapKey, Object value) {<br />
mapReport.put(mapKey, value);<br />
}<br />
<br />
public Object getMapReport(String mapKey) {<br />
System.out.println("mapReport.get(mapKey)"+mapReport.get(mapKey));<br />
return mapReport.get(mapKey);<br />
}<br />
<br />
<br />
}<br />
<br />
<span class='bbc_underline'><strong class='bbc'>in data Source Open function:</strong></span><br />
<br />
util = new Packages.Test.MapDao();<br />
<br />
reportVO=util.getReportVO("Julie");<br />
currentrow = 0;<br />
totalrows=1;<br />
<br />
<strong class='bbc'><strong class='bbc'><span class='bbc_underline'>in datasource Fetch Function:</span></strong></strong><br />
if(currentrow){<br />
datasetRow["FirstName"] = reportVO.getMapReport("FirstName");<br />
datasetRow["LastName"] = reportVO.getMapReport("LastName");<br />
<br />
<br />
currentrow++;<br />
return true;<br />
}<br />
<br />
return false;<br />
<br />
<br />
With the above coding I am not able to get anything in my Preview Results.<br />
<br />
Thanks,
Find more posts tagged with
Comments
johnw
currentrow will never return true since it is initialized to 0.
lchen
Try this:
http://blog.darevay.com/2007/11/scripted-data-sources-with-birt/