ho bisogno di fare rapporto come questo:Come creare più tabelle nel report jasper usando json come origine dati?
Product Name : Product XYZ
---------------------------------
| Item Name | Quantity | Price |
---------------------------------
| Item ABC | 10 | 10 $ |
| Item BCD | 10 | 1 $ |
Product Name : Product XYZ2
---------------------------------
| Item Name | Quantity | Price |
---------------------------------
| Item DEF | 15 | 10 $ |
| Item HIJ | 11 | 1 $ |
Summary Report
---------------------------------
| Product Name | Total Quantity |
---------------------------------
| Product XYZ | 20 |
| Product XYZ2 | 26 |
Il primo problema è "prodotto" lattina 1 a molti.
Il secondo problema è che ho bisogno "Rapporto di sintesi" in basso
Il terzo problema è, questo rapporto dati grezzi provenienti da json
, non da query di database.
cosa che ho già provo:
creare molti tavolo per il prodotto. Ma questo è fallito perché Jasper crea uno spazio vuoto per la tabella inutilizzata. E la tabella riassuntiva in un'altra pagina con molti spazi vuoti.
Sottoreport, come sopra.
Puoi dirmi, per favore, come rendere dinamicamente più tavoli?
EDIT: campione JSON
{"produkList": {
"items":[
{
"nameProduct": "Product XYZ",
"itemList": [{
"itemName": "XXXXXXX",
"quantity": 50,
"price": 50
},
{
"itemName": "YYYYYYY",
"quantity": 50,
"price": 50
},
{
"itemName": "ZZZZZZZZ",
"quantity": 50,
"price": 50
}]
},
{
"nameProduct": "Product XYZ2",
"itemList": [{
"itemName": "AAAAAAAA",
"quantity": 50,
"price": 50
},
{
"itemName": "BBBBBBB",
"quantity": 50,
"price": 50
},
{
"itemName": "CCCCCCC",
"quantity": 50,
"price": 50
}]
}
],
"summary":[
{
"title": "Summary Report",
"summaryReportDetailList": [{
"nameProduct": "Product XYZ",
"quantity": 150
},
{
"nameProduct": "Product XYZ2",
"quantity": 150
}]
}
]
}
}
hai Peter, provo il vostro esempio, ma ottengo questo errore net.sf.jasperreports.engine.JRException: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Errore valutazione di espressione per testo sorgente: ((al netto .sf.jasperreports.engine.data.JsonDataSource) $ P {} REPORT_DATA_SOURCE) subDataSource ("ITEMLIST") causato da:. java.lang.ClassCastException: net.sf.jasperreports.engine.JREmptyDataSource non può essere gettato a net.sf.jasperreports.engine.data.JsonDataSource – user2571094
Si sta passando una EmptyDataSource durante il processo di riempimento, non passare alcuna origine dati al report. (JasperFillManager.fillReport (report, paramMap);) (l'origine dati è definita all'interno di main.jrxml ... vedi