Add a rownum column beside a calculated one
| name | hour_rate | working_hours |
|---|---|---|
| John | $20/hrs | 123 hrs |
| Marry | $30/hrs | 112 hrs |
| Peter | $25/hrs | 132 hrs |
| Donald | $40/hrs | 89 hrs |
->pipe(new CalculatedColumn(array(
"rowNum"=>"{#}",
"total"=>"{hour_rate}*{working_hours}"
)))
| name | hour_rate | working_hours | rowNum | total |
|---|---|---|---|---|
| John | $20/hrs | 123 hrs | 0 | $2,460 |
| Marry | $30/hrs | 112 hrs | 1 | $3,360 |
| Peter | $25/hrs | 132 hrs | 2 | $3,300 |
| Donald | $40/hrs | 89 hrs | 3 | $3,560 |