XToolset
XToolset copied to clipboard
Nested loop not working as expected
Greetings, thank you for this amazing library.
I am currently facing some issue defining nested loop (loop within loop), which I think is pretty common in reporting.
Template:
With the example view model:
{
"transactionGroups": [
{
"title": "My Group",
"transactions": [
{
"transactionNo": "Transaction No 1",
"referenceNo": "Reference No 1",
"amount": 1000
},
{
"transactionNo": "Transaction No 2",
"referenceNo": "Reference No 2",
"amount": 1000
},
{
"transactionNo": "Transaction No 3",
"referenceNo": "Reference No 3",
"amount": 1000
},
{
"transactionNo": "Transaction No 4",
"referenceNo": "Reference No 4",
"amount": 1000
}
]
},
{
"title": "My Second Group",
"transactions": [
{
"transactionNo": "Transaction No 5",
"referenceNo": "Reference No 5",
"amount": 1000
},
{
"transactionNo": "Transaction No 6",
"referenceNo": "Reference No 6",
"amount": 1000
},
{
"transactionNo": "Transaction No 7",
"referenceNo": "Reference No 7",
"amount": 1000
},
{
"transactionNo": "Transaction No 8",
"referenceNo": "Reference No 8",
"amount": 1000
},
{
"transactionNo": "Transaction No 9",
"referenceNo": "Reference No 9",
"amount": 1000
},
{
"transactionNo": "Transaction No 10",
"referenceNo": "Reference No 10",
"amount": 1000
},
{
"transactionNo": "Transaction No 11",
"referenceNo": "Reference No 11",
"amount": 1000
},
{
"transactionNo": "Transaction No 12",
"referenceNo": "Reference No 12",
"amount": 1000
}
]
}
]
}
Output
Expected
I am just experimenting around and if this works, I would also need to add in the grand total which takes the SUM of all Subtotal cell etc. However I couldn't get this first step working, suspect there is something wrong with nested loop. (The second group loop begins with transaction 10
which is odd, seems like it is "continueing" from the first group iteration or something)
Thank you and hope to hear from you soon!