Jump to content

JasperSoft Studio: How to write JSON Adapter Query?


FlowingRiver

Recommended Posts

Dear community,

To begin with, I would like to say that I am new to programming.

I am working with a JSON data adapter and would like to select some fields for my report via query. I don't understand what syntax to use here, as the only thing working is  some direct stating of fields, like "features" or "features.geometry". How can I for example select "features.geometry.coordinates" and "features.properties.OBJECTID" in one query? AND, +, &&, ,,, none of these work. This limits me to only import fields from the same level via query.

I am aware that I can drag and drop the fields or use the "add button". But my aim is to later pass on fields to include (trough parameters) via a batch file, so that would barely work with a manual approach, or would it?

My GeoJSON looks like this exemplary:

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "id": 1,
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [8.058239806419923, 48.52240926714301],
            [8.058239767994523, 48.52241117362527],
            [9.058208135484273, 48.52241521836773]
          ]
        ]
      },
      "properties": {
        "OBJECTID": 1,
        "ID": "F1",
        "OBJEKTNUMMER": "O78",
        "PRODUKTNUMMER": 1090,
        "PREIS_ID": 10909999,
        "STADTTEIL": "Zentrum",
        "CREATED_USER": "Testuser",
        "SHAPE.AREA": 11.58827925,
        "SHAPE.LEN": 14.7060121161454
      }
    }
  ]
}

Thank you very much for your support in advance.

 

frage_jaspersoft.PNG

Edited by FlowingRiver
Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Hi @FlowingRiver

Jaspersoft doesn't support querying all the hierarchical data using jsonql. Though please refer to below examples where it shows different options on traversing the hierarchical json data.

 

 

https://jasperreports.sourceforge.net/sample.reference/jsonqldatasource/README.html

https://github.com/TIBCOSoftware/jasperreports/tree/jr-6-3-1/jasperreports/demo/samples/jsonqldatasource/reports

I hope this helps.

 

Link to comment
Share on other sites

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