JSONQL: Retrieve values from array wthout key/index

Hi everyone,

I need to retrieve values from JSON datasource without an index/key.

Examples:

"items": [
    "items 1", 
    "items 2", 
    "items 3", 
    "items 4", 
    "items 5"
]

How can I retrieve all values from items?

I have tried:

  • items.* (only return first element)
  • items.[n] (only return [n] index element)
  • items.[x:y] (only return [x] index element)

And yes, I have read JSONQL docs http://jasperreports.sourceforge.net/sample.reference/jsonqldatasource/index.html

Thanks!

shavaughn70's picture
Joined: Sep 9 2019 - 4:26am
Last seen: 3 years 5 months ago

What does your JRXML look like?

narcism - 3 years 6 months ago

1 Answer:

You can pass array as DataSource to a table (for example) like

((net.sf.jasperreports.engine.data.JsonQLDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("items")

And then use array element for Text Field like $F{node}

d-nibaev's picture
Joined: Oct 26 2020 - 10:20pm
Last seen: 1 year 10 months ago
Feedback