epistolarum Posted September 2, 2016 Share Posted September 2, 2016 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 More sharing options...
epistolarum Posted September 6, 2016 Author Share Posted September 6, 2016 I didn't fond a solution with a filter, but I resolved the issue with following solution.1. I defined a language.value field for the subdataset.2. Add a print when expression for the list fields 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