I have an xml sample similar to this:
<LIST>
<G_1>
<EMPLOYEE_NUMBER>1</EMPLOYEE_NUMBER>
<G_2>
<ELEMENT>Basic</ELEMENT>
<VALUE>10</VALUE>
<GROSS>12</GROSS>
<TYPE>Earning</TYPE>
</G_2>
<G_2>
<ELEMENT>Transport</ELEMENT>
<VALUE>11</VALUE>
<TYPE>Earning</TYPE>
<GROSS>15</GROSS>
</G_2>
<G_2>
<ELEMENT>Food</ELEMENT>
<VALUE>7</VALUE>
<TYPE>Earning</TYPE>
<GROSS>8</GROSS>
</G_2>
<G_2>
<ELEMENT>Tax</ELEMENT>
<VALUE>5</VALUE>
<TYPE>Deduction</TYPE>
</G_2>
<G_2>
<ELEMENT>Pension</ELEMENT>
<VALUE>3</VALUE>
<TYPE>Deduction</TYPE>
</G_2>
</G_1>
</LIST>
Now I have created a table with 5 columns and I want to loop through all the employee records (G_1).
The first 3 columns will be for G_2 records of type Earning, then the next two will be for Deduction. So we should have:
ELEMENT | VALUE | GROSS | ELEMENT | VALUE
Basic 10 12 Tax 5
Transport 11 15 Pension 3
Food 7 7
I have tried two for-each loops in my row like:
for-each:G_2[TYPE='Earnings'] ELEMENT RESULT GROSS end for-each:G_2[TYPE='Deductions'] ELEMENT RESULT end
But this only works for the first 3 columns but returns blank for the rest (Deductions).
Any one have an idea of workaround?
I have even tried a for and end with each column cell but that hasn’t worked either.
This is basically a payslip report with earnings in one group of columns and deductions on another.
Thanks