in
Forums
Blogs
Files
Devexpress.Com
Client Center
Support Center
DevExpress Channel

join with aggregation

Last post 8/10/2007 1:38 PM by Rollie Claro. 4 replies.
Page 1 of 1 (5 items)
Sort Posts:
Previous Next
  • 7/9/2007 10:07 AM

    join with aggregation

    classical situation - tables customers, orders, order_details, need customer names and sum of orders in one grid, how to describe xpView property to feed the grid with required information?

    customer
    ------------------------
    id
    name

    order
    ------------------------
    id
    date
    customer_id

    order_details
    ------------------------
    id
    order_id
    product_id
    price
    count

     

     

    Filed under:
  • 8/10/2007 8:04 AM In reply to

    Re: join with aggregation

    I'm facing the same problem, any suggestion would really help.

  • 8/10/2007 10:57 AM In reply to

    Re: join with aggregation

    Hi,

     
        I have attached a simple application that does Sum and Counting for Order - OrderDetails

     


     

    develop a software that even a fool can use, and only a fool will use it
  • 8/10/2007 11:36 AM In reply to

    Re: join with aggregation

    Hi, tnx for the reply but this isn't working for me, or at least isn't what i need. In my scenario I have an XPView mapped to Customer object type, and what i need is a property column inside XPView that maps to Orders[].OrderDetails[].Sum(Price) but this syntax isn't valid for a property. It accepts a property like Orders[].Sum(OrderDetails[].Sum(Price)) but then SQL Server throws an exception cause the sql query isn't valid.

    Any other idea ? The main point is that i need all customers even if they have no orders.

    tnx in advance

    Luca

  • 8/10/2007 1:38 PM In reply to

    Re: join with aggregation

    ok i get it.

     

       your xpView is refers to Customer. where customer has Order and OrderDetails. you want to get the sum and count for OrderDetails. if it is Order, then it would be something like

    Orders.Count, Orders.Sum(?)

     
    but how do you apply this concept to OrderDetails? surely


    OrderDetails.Count, OrderDetails.Sum(?)

     
    wont work when you are referencing Customer in XPView.
     

    i dont think you can do this by simply assigning a property eval. but i have a workaround. see the updated attached file.

     

     

    develop a software that even a fool can use, and only a fool will use it
Page 1 of 1 (5 items)
Copyright © 1998-2008 Developer Express Inc.
ALL RIGHTS RESERVED