0 Replies Latest reply on Jun 14, 2013 12:59 AM by user8742475

    How to sum from 2 fields?

    user8742475

      Here's my xml

       

      <ticket><sold>0</sold><price>7.0</price></ticket>

      <ticket><sold>1</sold><price>7.0</price></ticket>

      <ticket><sold>1</sold><price>7.0</price></ticket>

       

      I want to sum the total sale prices, in this case it will be $14.00 because the 1st one does not sell any ticket

       

      One more thing, the <sold></sold> tag will only have 2 values (1 or 0)

       

      The simplest way I think of is to multiple price with sold for each ticket and then sum it all up.

       

      I group by <ticket> and below is my code but I got 0

       

      <?sum(current-group()/sold * current-group()/price)?>

       

      Do you know why? If you have a simpler approach, please let me know

       

      Thanks