Json datasource : use values directly or check if keys/values in data

0

Hi,

here is my json structure :

{
    "main": {
        "parcel": {
            "id": "10AB01"
        },
        "rules": [
            {
                "key": "maxheight",
                "value": "20m"
            },
            {
                "key": "mindist",
                "value": "2m"
            }
        ],
        "addresses": [
            {
                "address": "1 King Road",
                "key": "park",
                "value": "no"
            },
            {
                "address": "2 queen alley",
                "key": "park",
                "value": "yes"
            }
        ]
    }
}

My report (launched from librairy, not JasperServer) should have a fixed content (not looping on sub list, juste acces the "main" object) and show :

- information from the parcel object (ex : parcel ID in the report Title section or at the top of the Detail section)

- key/values from the rules list : checkboxes checked or not (using image) depending on key/values found in the "rules" json attribute

ex: according to the the above json example, 3 checkboxes + text in the report should be shown as follow :

key "mindist" is in the liste so : checked.png + "Minimum distance to road should be applied to parcel : " + value form key = mindist

key "maxheight" is in the list so : checked.png + "Maximum build height sould be : " + value for key = maxheight

key "housecolor" is not in the liste so : unchecked.png + "House color should be : " + ""

- use addresses in sub tables.

I did set the JSON data adaptator on the "Main" and i get 3 fields in my report : parcel, rules, addresses

but i can't find how i should configure the fields and use them as json in the report to get my result.

thanks for your help.

Best regards,

Guillaume

guigui94's picture
Joined: Mar 19 2010 - 1:51am
Last seen: 1 year 8 months ago

0 Answers:

No answers yet
Feedback