Hi,
I have a requirement to display add a filed in the xml root tag which is of sequence and add that filed only to last iteration of sequence.
I ahve a classs
case class Account(accTran: Seq[AccTran])
case class AccTran(Tran, BookDate,Tamt)
Object class AccTran {
def apply(a: Abc): AccTran =
Acctran(Tran =a.tran,BookDate=a.bookDate,Tamt=a.tamt)
}
case class Abc( tran,bookDate,tamt)
case class AccBal(balanceAmt: Bigdecimal)
When i get value from the class Abc i will be having Abc sorted based on bookdate.
Account class would be written to xml as seq of AccTran fields
My requirement is to add a field BalanceAmt field only to the last iteration of AccTran seq.
So in which class i can add this field BalanceAmt and write
So output xml should look like with
<Account>
abc
01011950
123
xbc
01011950
123
ybc
01011950
123
345
Please let me know how i can accomplish this.
Thanks