JSONQL: How to access JSON data outside the data array

Hi,

How to access JSON data outside the data array?

I have a simple JSON File and the JSON Data Adapter with jsonql

{
    "inventory": {
        "inventur": "Test_2_INT_2021-08-02",
        "supplier": "114609",
        "date": "Aug 19, 2021"
    },
    "assets": [
        {
            "asset": "OA_S10005204",
            "partnumber": "7341719-2",
            "inventnr": "10056137"
        },
        {
            "asset": "OA_S10005208",
            "partnumber": "7338320-3",
            "inventnr": "10056126"
        }
    ]
}

The jsonql query is "assets" and in the "Details"-area I can access all assets data: see attached screenshot

In the "Title"-area I need the $.inventory.inventur field but can't get it run

I tried

    <field name="inventory.inventur" class="java.lang.Integer">
        <property name="net.sf.jasperreports.jsonql.field.expression" value="inventory.inventur"/>
        <fieldDescription><![CDATA[$.inventory.inventur]]></fieldDescription>
    </field>


but the result is "null": see attached Screenshot

I also tried

    <queryString language="jsonql">
        <![CDATA[]]>
    </queryString>

but in this case the "assets" data array ist missing

Any idea?

Thanx

Frank

frank.leverenz's picture
Joined: Feb 17 2022 - 12:26am
Last seen: 1 year 1 month ago

0 Answers:

No answers yet
Feedback