Jump to content

Showing Multiple Markers on Map Component even subdataset returns single row of lat-long


sharad.p.singh

Recommended Posts

On Jasper Report, I have a map component in detail band. I am showing an object on map as per the lat/long returned from database. I am restricted to show all markers on single map thats why I have to put this component in detail band. Map component is iterating itself and showing multiple maps each carrying single marker indicating the object's location.

For first few records, rendered maps are fine showing single marker but as I scroll down the report, maps start showing multiple markers. I am not getting from where it is picking the data as subdataset is returning single row only. I tried resetting the marker data but it didnt help too. I am using Jasper's Product Version: 5.6.0, Build: 20140608_2355. Please help.

XML Code:

<mp:markerData><dataset resetType="None">    <datasetRun subDataset="location_ds" uuid="7aee1e39-c256-4e62-83f2-eda8a73b48ad">        <datasetParameter name="histid"/>    </datasetRun></dataset><mp:item>    <mp:itemProperty name="latitude">        <valueExpression><![CDATA[$F{histlat}]]></valueExpression>    </mp:itemProperty>    <mp:itemProperty name="longitude">        <valueExpression><![CDATA[$F{histlong}]]></valueExpression>    </mp:itemProperty></mp:item>[/code]

Map screenclip:

ScreenShot2016-01-30at4_19_43PM(1).png.dd5be76574b2f715c5829f628f452ca4.png

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

For detail band nature, it is normal to behave like that. For example in first iteration dataset has one row but second iteration the result set has two row and goes like that. So. first evaluation of detail band your map has one marker and second iteration there will be two marker with previous one. 

Create two parameters for lat and long data and try to assign your lat and long fields to that parameters. So your parameters will hold last record while each detail band evaluation. After that use that parameters, not fields, for markers.

Link to comment
Share on other sites

Thanks for your prompt response. Yes looks like a valid solution. 

Now report is giving exception that lat and long field can not be empty for markers. I am sure I am not setting parameter values with lat/long from dataset at right time.

Please help assigning values to these parameters?

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...