Jump to content
Changes to the Jaspersoft community edition download ×

Field name with dot in Json datasource using ireport


arasu_se

Recommended Posts

My sample json file content

{"FlightLog":{    "FlightLog.crewMembers":[    ],    "destinationStationCode":"JPN",    "FlightLog.destinationStationCode":"IND",    "FlightLog.originStationCode":"IND",    "FlightLog._lockVersion":"0",    "FlightLog.flightNum":"123"}}[/code]

I want to get value for FlightLog.FlightLog.originStationCode.

for eg: When i declare field name as below , i am getting the value "JPN"

<field name="FlightLog.destinationStationCode" class="java.lang.String">    <fieldDescription><![CDATA[FlightLog.destinationStationCode]]></fieldDescription></field>[/code]

Whereas if i declare field as below,

<field name="destinationStationCode" class="java.lang.String">    <fieldDescription><![CDATA[FlightLog.FlightLog.destinationStationCode]]></fieldDescription></field>[/code]

I am not getting any value for the above code.

I tried using

<field name="destinationStationCode" class="java.lang.String">    <fieldDescription><![CDATA[FlightLog[FlightLog.destinationStationCode]]]></fieldDescription></field><field name="destinationStationCode2" class="java.lang.String">    <fieldDescription><![CDATA[FlightLog.FlightLog\.destinationStationCode]]></fieldDescription></field>[/code]

How can i do this?

Link to comment
Share on other sites

  • 1 year later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

This will be possible in JasperReports Library and JasperSoft Studio starting with version 6.3.1. iReport is no longer supported as of version 5.5.0.

With this release, a new JSON query language(JSONQL) will be available for use. It is meant to replace the existing language for querying JSON data. New sample with extensive documentation will be available in the Data Source / Query Executer section of the sample reference page(http://jasperreports.sourceforge.net/sample.reference.html) once the 6.3.1 release is out.

Your jrxml is, most likely, going to look like this:

<queryString language="jsonql">

<![CDATA[FlightLog]]>

</queryString>

<field name="DestinationStationCode" class="java.lang.String">

<propertyExpression name="net.sf.jasperreports.jsonql.field.expression"><![CDATA["["FlightLog.destinationStationCode]"]]></propertyExpression>

</field>

<field name="OriginStationCode" class="java.lang.String">

<propertyExpression name="net.sf.jasperreports.jsonql.field.expression"><![CDATA["["FlightLog.originStationCode]"]]></propertyExpression>

</field>

<field name="LockVersion" class="java.lang.String">

<propertyExpression name="net.sf.jasperreports.jsonql.field.expression"><![CDATA["["FlightLog._lockVersion]"]]></propertyExpression>

</field>

<field name="FlightNum" class="java.lang.String">

<propertyExpression name="net.sf.jasperreports.jsonql.field.expression"><![CDATA["["FlightLog.flightNum]"]]></propertyExpression>

</field>

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...