Create subreports with json

0
Hi everyone, I have a problem working with the Json data source and subreports.
 
I have the following json:
 
{
  "DetailPerRut": {
  
    "Name": {
      "Var1": "Lily",
      "Var2": "city1",
      "Var3": "a",
      "Var4": "b",
      "Var5": "c"
    }
 
    "Gifts": {
      "Details": [
        {
          "Date": "12/12/2000",
          "Body": 2,
          "Page": 45,
          "Extract": 4,
          "Acr": "123456789-0",
          "Acr2": "test1"
        },
        {
          "Date": "12/12/2010",
          "Body": 3,
          "Page": 33,
          "Extract": 6,
          "Acr": "123456789-0",
          "Acr2": "test2"
        }
      ]
    }
 
  }
}
 
 
I tried to create a main report and a sub report but the sub report does not show the information, nothing.
 
I have read the little information about working with JSON but none help me much.
 
 
I just want to show in the main report the detail of "Gifts" with a sub-report. And "DetailPerRut" in the main report.
 
In "Gifts" I want to make a table that shows a header by register, that is.
 
-------------------------------------------------- -------------------------------------------------- ----
| Date           | Body | Page | Extract |        Acr        |      Ac2                   |
-------------------------------------------------- -------------------------------------------------- ----
| 12/12/2000 | 2,        | 45    |    4      | 123456789-0 |      Test1                    |
-------------------------------------------------- -------------------------------------------------- ----
 
 
-------------------------------------------------- -------------------------------------------------- ----
| Date          |     Body     |     Page    | Extract |     Acr          |     Ac2        |
-------------------------------------------------- -------------------------------------------------- ----
| 12/12/2000 |     2,          |     45         |     4    | 123456789-0 |     Test1     |
-------------------------------------------------- -------------------------------------------------- ----
 
 
please, I need your help :D
 
Thank you community !!
asd.backup's picture
Joined: Mar 21 2017 - 7:53am
Last seen: 2 days 21 hours ago

1 Answer:

0

I I already found the solution. It's simple, in the main report I added the route.

 
DetailPerRut
 
Also, within the main report, I added the sub report element with the following settings within the properties.
 
((Net.sf.jasperreports.engine.data.JsonDataSource) $ P {REPORT_DATA_SOURCE}). SubDataSource ("Gifts.Details").
 
I hope someone helps this solution.
asd.backup's picture
Joined: Mar 21 2017 - 7:53am
Last seen: 2 days 21 hours ago
Feedback
randomness