Jump to content
Changes to the Jaspersoft community edition download ×

How to filter a json list in a jasper report


epistolarum

Recommended Posts

Hi all, I have a json source for a report that contains a list like

 

<pre language="javascript">

"DescrDescriptionShort":[  

   {  

      "language":{  

         "label":"Language",

         "tooltip":"bla bla",

         "value":"German",

         "type":"CodeKeyType"

      },

      "descriptionShort":{  

         "label":"Description",

         "tooltip":"bla bla",

         "value":"Mini Frösche Bonbons",

         "type":"String"

      }

   },

   {  

      "language":{  

         "label":"Language",

         "tooltip":"bla bla",

         "value":"Danisch",

         "type":"CodeKeyType"

      },

      "descriptionShort":{  

         "label":"Description",

         "tooltip":"bla bla",

         "value":"Mini frogs",

         "type":"String"

      }

   }

]

</pre>

 

Id like to get the text fields with descriptionShort.label and descriptionShort.value but only for language.value == German. So first I tried to create a sub data set like 

bellow and use it in my list:

 

<subDataset name="descrDataset" uuid="ec0a8e9b-ea20-4b64-9363-5668c90a2f04">

<queryString language="JSON">

<![CDATA[language.value == German]]>

</queryString>

<field name="descr-label" class="java.lang.String">

<fieldDescription><![CDATA[descriptionShort.label]]></fieldDescription>

</field>

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

<fieldDescription><![CDATA[descriptionShort.value]]></fieldDescription>

</field>

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

<fieldDescription><![CDATA[language.value]]></fieldDescription>

</field>

</subDataset>

 

But it seems that queryString exprecions has no impact - the list displays all values. I also tries

 

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

<fieldDescription><![CDATA[DescrDescriptionShort(language.value == German)[0].descriptionShort.value]]></fieldDescription>

</field>

 

But this causes an Exception "net.sf.jasperreports.engine.JRException: Invalid attribute selection expression: ZasDescrDescriptionShort(language."

 

Any Idea how I can filter a json list in a jasper report?

 

Many thanks and regards,

Andrej

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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