JSONQL: Retrieve values from array wthout key/index

Jaspersoft Community 'Read-Only' as of July 8, 2022

Transition to New TIBCO Community Just Weeks Away

You can still search, review wiki content, and review discussions in read-only mode. Please email community@tibco.com with questions or issues requiring TIBCO review or response.

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: 2 years 8 months ago

What does your JRXML look like?

narcism - 2 years 9 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 1 month ago
Feedback
randomness