ankit.maurya Posted June 7, 2019 Share Posted June 7, 2019 The problem is as described below:I have a SQL(Postgresql) table as given below and I am using spring-hibernate to use it as my data source for the report.Col 1Json Col-1{"Id": 5, "name": "MNP"}0{"Id": 6, "name": "Abc","Id": 12, "name": "JKL"}-1{"Id": 7, "name": "Def"} I have to make a table in the report with the same data but in below-given way:Col 1MNPABCDefJklJson Col-1MNP {"Id": 5, "name": "MNP"}0 Abc Jkl{"Id": 6, "name": "Abc","Id": 12, "name": "Jkl"}-1 Def {"Id": 7, "name": "Def"}for this, there are two fields for the table as col_1 and json_coland everything works fine and the report gets generated when it is just this.But when I add a third field "MNP"<field name="MNP" class="java.lang.String"> <property name="net.sf.jasperreports.jsonql.field.expression" value="name"/></field>and other fields as in tableUsing the json query below<queryString language="jsonql"> <![CDATA[$F{json_col}]]> </queryString> Both the previous column still displays data but the new columns are blank.Any help is really appreciated. Link to comment Share on other sites More sharing options...
mtn Posted June 9, 2019 Share Posted June 9, 2019 Is there a reason why you do not use postgresql to extract the value in a new column and use it in jaspersoft? Link to comment Share on other sites More sharing options...
ankit.maurya Posted June 10, 2019 Author Share Posted June 10, 2019 Because here in some cases we have multiple values in json_col and that is not fixed, some json_col has one key and value whereas some have more than one.So the actual case is that there will be a new column for each new value. name1, name2, name3 and so on. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now