Menu

Help with performance

homer111
2005-01-24
2013-03-07
  • homer111

    homer111 - 2005-01-24

    I need help with this situation:
    Table: OrderHeader
    Table: OrderLines with fields: qty,price
    In a listview i wanna see the list of table OrderHeader with a column total=sum(qty*price) for all lines of this order.
    What is the best approach?
    -Use a SQL to retrieve the value for each OrderHeader.
    - Can i create a property Total in OrderLines, mark it as proxy and retrieve it with orderheaders?
    - More....
    -What do you think???

    thanks

     
    • Richard Banks

      Richard Banks - 2005-01-24

      Well, the best option is really up to you.  However I would probably do something like the following:

      1. Add a total column to both the order header and the order lines.  (I'm a fan or "practical" database schemas)

      2. Change the order line object so that when qty or price is updated both the line total and header totals get updated.  Don't foget to handle line deletion as well.

      3.  Ensure that the association between orderlines and orderheaders is autosave and autoretrieve

      Now when I just need an order header I can access the total via the property.  If I need individual line totals I can get that via the line total field.

      There is no need to use a CSummaryCriteria to calculate totals, there is no need to iterate through the lines and do a calculation and if you have to do reporting directly from the database, the order total is there at the header level.

      - Richard.

       
    • homer111

      homer111 - 2005-01-25

      ok, is an idea. I'm thinking about it, but for curiosity and to know the two systems. How do you make it using CSummaryCriteria?
      The help isn't very clearly.... ;-)

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.