Loading ...
Sorry, an error occurred while loading the content.
 

Running total

Expand Messages
  • hakan.lindestaf@epani.com
    I m facing a problem where I have a collection with items which has a number that I would like to sum up in the end of the report like a total, grand total or
    Message 1 of 3 , Mar 1, 2001
      I'm facing a problem where I have a collection with items which has a
      number that I would like to sum up in the end of the report like a
      total, grand total or running total (whatever it's called).
      Something like this:

      Total = 0
      for each item in collection
      display item
      Total = Total + item.SubTotal
      next


      Since I can't assign values to variables more than once I'm out of
      ideas. I'm currently using some functions in VBScript (like formating
      date, etc) and I guess I could make this in VBScript, but it would be
      nicer to have as much as possible in XSL.

      Thanks,

      /Hakan
    • Wendell Piez
      XPath also has a sum() function which is useful in simpler cases. Regards, Wendell ... ======================================================================
      Message 2 of 3 , Mar 6, 2001
        XPath also has a sum() function which is useful in simpler cases.

        Regards,
        Wendell

        At 07:11 AM 3/6/01 -0800, you wrote:


        >-----Original Message-----
        >From: hakan.lindestaf@... [mailto:hakan.lindestaf@...]
        >I'm facing a problem where I have a collection with items which has a
        >number that I would like to sum up in the end of the report like a
        >total, grand total or running total (whatever it's called).
        >Something like this:
        >
        >Total = 0
        >for each item in collection
        > display item
        > Total = Total + item.SubTotal
        >next
        >
        >
        >I don't know if anyone replied to this yet, but it seems like a perfect
        >place to apply a recursive summing solution using XSLT.
        >The solution will depend on the shape of your data, so check out the FAQ on
        >this:
        >http://www.dpawson.co.uk/xsl/recursion.html
        >
        >I hope that helps
        >
        >Edmund
        >
        >To unsubscribe from this group, send an email to:
        >XSL-FO-unsubscribe@egroups.com
        >
        >
        >
        >Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

        ======================================================================
        Wendell Piez mailto:wapiez@...
        Mulberry Technologies, Inc. http://www.mulberrytech.com
        17 West Jefferson Street Direct Phone: 301/315-9635
        Suite 207 Phone: 301/315-9631
        Rockville, MD 20850 Fax: 301/315-8285
        ----------------------------------------------------------------------
        Mulberry Technologies: A Consultancy Specializing in SGML and XML
        ======================================================================
      • Edmund Mitchell
        ... From: hakan.lindestaf@epani.com [mailto:hakan.lindestaf@epani.com] I m facing a problem where I have a collection with items which has a number that I
        Message 3 of 3 , Mar 6, 2001
          -----Original Message-----
          From: hakan.lindestaf@... [mailto:hakan.lindestaf@...]
          I'm facing a problem where I have a collection with items which has a
          number that I would like to sum up in the end of the report like a
          total, grand total or running total (whatever it's called).
          Something like this:

          Total = 0
          for each item in collection
          display item
          Total = Total + item.SubTotal
          next


          I don't know if anyone replied to this yet, but it seems like a perfect
          place to apply a recursive summing solution using XSLT.
          The solution will depend on the shape of your data, so check out the FAQ on
          this:
          http://www.dpawson.co.uk/xsl/recursion.html

          I hope that helps

          Edmund
        Your message has been successfully submitted and would be delivered to recipients shortly.