My json is a list that contains a list, which contains another list (triple nested). I am using an xlsx template, which I think should allow what I’m attempting. I can refer to and print out fields from the second layer list, but not the third layer. I’ll include xml and json examples below. The xml uses jsonpath evaluation to retrieve the data for the template.
JSON:
{
"CarList": [
{
"CarId": 1,
"CarName": "Tatla",
"CarMakeList": [
{
"CarId": 1,
"CarMakeId": 1,
"CarMakeName": "Jeep",
"CarMakeModelList": [
{
"CarMakeId": 1,
"CarMakeModelId": 1,
"CarMakeModelName": "Cherokee"
}
]
},
{
"CarId": 1,
"CarMakeId": 2,
"CarMakeName": "Mercedes",
"CarMakeModelList": [
{
"CarMakeId": 2,
"CarMakeModelId": 2,
"CarMakeModelName": "C63S"
}
]
},
{
"CarId": 1,
"CarMakeId": 3,
"CarMakeName": "Chevy",
"CarMakeModelList": [
{
"CarMakeId": 3,
"CarMakeModelId": 3,
"CarMakeModelName": "Silverado"
}
]
}
]
},
{
"CarId": 2,
"CarName": "Samrai",
"CarMakeList": [
{
"CarId": 2,
"CarMakeId": 4,
"CarMakeName": "Porsche",
"CarMakeModelList": []
},
{
"CarId": 2,
"CarMakeId": 5,
"CarMakeName": "Mercedes",
"CarMakeModelList": []
}
]
},
{
"CarId": 3,
"CarName": "Bhangu",
"CarMakeList": [
{
"CarId": 3,
"CarMakeId": 6,
"CarMakeName": "Porsche",
"CarMakeModelList": []
},
{
"CarId": 3,
"CarMakeId": 7,
"CarMakeName": "Mercedes",
"CarMakeModelList": []
},
{
"CarId": 3,
"CarMakeId": 8,
"CarMakeName": "Toyota",
"CarMakeModelList": []
}
]
}
]
}
XML:
<?xml version="1.0" encoding="UTF-8"?>
<report name="report">
<templates>
<template code="DEFAULT" documentName="NestedBandsTestReportPdf.xlsx" documentPath="NestedBandsTestReportPdfTemplate.xlsx" outputType="pdf" outputNamePattern="NestedBandsTestReportPdf.pdf"/>
</templates>
<rootBand name="Root" orientation="H">
<bands>
<band name="CarListBand" orientation="H">
<bands>
<band name="CarMakeListBand" orientation="H">
<bands>
<band name="CarMakeModelListBand" orientation="H">
<queries>
<query name="CarMakeModelListBandData" type="json">
<script>
parameter=param1 $.CarList[?(@.CarId=='${CarListBand.CarId}')].CarMakeList[?(@.CarId=='${CarListBand.CarId}')].CarMakeModelList[*]
</script>
</query>
</queries>
</band>
</bands>
<queries>
<query name="CarMakeListBandData" type="json">
<script>
parameter=param1 $.CarList[?(@.CarId=='${CarListBand.CarId}')].CarMakeList[*]
</script>
</query>
</queries>
</band>
</bands>
<queries>
<query name="CarListBandData" type="json">
<script>
parameter=param1 $.CarList[*]
</script>
</query>
</queries>
</band>
</bands>
</rootBand>
</report>
PDF output from template:
CarListBand and CarMakeListBand print out as expected but CarMakeModelListBand keeps grabbing cherokee for all the makes.
Expected output:
OWNER: Tatla
MAKE: Jeep
MODEL: Cherokee
MAKE: Mercedes
MODEL: C63S
MAKE: Chevy
MODEL: Silverado
OWNER: Samrai
MAKE: Porsche
MODEL:
MAKE: Mercedes
MODEL:
OWNER: Bhangu
MAKE: Porsche
MODEL:
MAKE: Mercedes
MODEL:
MAKE: Toyota
MODEL:
I’d appreciate any insight into why I’m unable to properly retrieve data from the 3rd layer of the json. Thanks.