Jump to content
JasperReports Library 7.0 is now available ×

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


guigui94

Recommended Posts

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"            }        ]    }}[/code]

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

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

  • Replies 0
  • 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...