Problem in using column expression plz help

yub140000

Member
Joined
Feb 17, 2005
Messages
7
Programming Experience
Beginner
Hello Every One.
Wishing u all a good day,
My problem is as follows :
I have to tables in dataset Ds1 as tblinvoice(InvNo,FCustNo,InvDate) and TblInvoiceDetails(FInvNo,Qty,Price)
I have created a relationship between them as follows
Ds1.relations.add("InvDetRel",Ds1.TblInvoice.InvNo,Ds1.TblInvoiceDetails.FInvNo)
In the code (not in the backend) i have added to TblInvoiceDetails one column that contains expression Price * Qty
as follows :
TblInvoiceDetails.columns.add("RowAmount",system.type.gettype("system.decimal")."Price * Qty")
Now I want to add a column in the frontend to TblInvoiceDetails to
display the total amount of rowamount for respective invoice No.
i added the following column
TblInvoiceDetails.columns.add("TotAmount",system.type.gettype("system.decimal")."Sum(RowAmount)")
But it displyed sum of the entire rowamount column
if a table tblinvoice contains following data
InvNo FCustNo InvDate
0 0 Null
1 1 Null
and the table tblinvoicedetails contains following data
FInvNo Price Qty RowAmount(This is in FrontEnd Only) TotalAmount(Same Only in frontend)
0 10 2 20(Calculated by expression) 85
0 5 3 15 85
1 20 2 40 (same as above) 85
But the output should be
FInvNo Price Qty RowAmount(This is in FrontEnd Only) TotalAmount(Same Only in frontend)
0 10 2 20(Calculated by expression) 35
0 5 3 15 35
1 20 2 40 (same as above) 40
Now I change the expression of totalamount column to "Sum(Child(InvDetRel).RowAmount)"
But it was giving me as error messgae as
Unbound reference in the aggregate function .....
I will keep trying but any help will be very appreciated.
 
Back
Top