Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Totals within a list box

Status
Not open for further replies.

webpager

Programmer
Joined
Mar 27, 2001
Messages
166
Location
GB
Hi all,
I have an app. which stores individual items into ORDERS.DBF. These items are added throughout the week as and when an order comes in for a particular product.
I store the items as seperate files as I found that this also doubles as a order log.
My problem arises when I wish to update the order summary which takes the form of 4 seperate list boxes. Each list box displays the appropriate records as a result of an SQL statement.
Here`s the problem - The list box displays each order line seperately ie.

ITEM 1 - 3
ITEM 2 - 5
ITEM 1 - 3
ITEM 1 - 4
ITEM 2 - 2

Very confusing, So I want to diaplay totals of each, in the list box as follows:-

ITEM 1 - 10
ITEM 2 - 7

Do I need to create another cursor or can this be achieved through modifying my SQL statement.


SELECT order2.MOULD_REF, MOULDING.MOULD_NAM,order2.fwidth, ;
order2.fheight, order2.QTY ;
FROM order2 INNER JOIN MOULDING ;
ON order2.MOULD_REF = MOULDING.MOULD_REF;
WHERE order2.FRINTON<>&quot;FR&quot; AND order2.flength=0 AND order2.ORDERED<>&quot;Y&quot; ;
AND order2.MARKD<>&quot;Y&quot;;
ORDER BY order2.fwidth ;
INTO ARRAY LENFRAME

Thanks in advance
Keith
 

SELECT order2.MOULD_REF, MOULDING.MOULD_NAM,order2.fwidth, ;
order2.fheight, SUM(order2.QTY) AS qty ;
FROM order2 INNER JOIN MOULDING ;
ON order2.MOULD_REF = MOULDING.MOULD_REF;
WHERE order2.FRINTON<>&quot;FR&quot; AND order2.flength=0 AND order2.ORDERED<>&quot;Y&quot; ;
AND order2.MARKD<>&quot;Y&quot;;
ORDER BY order2.fwidth ;
GROUP BY yourItemCode ;
INTO ARRAY LENFRAME

Suitably change yourItemCode.. I cannot follow the field names quickly, So I leave that for you.

:-)
ramani :-)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
Cheers ramani
If I understand correctly - without the &quot;GROUP BY&quot; command, all the QTY fields would be added together where as the &quot;GROUP BY&quot; command sums each item seperately.
Once again thanks
Keith
 
I have now come against a problem doing the same grouping within a report. I need to create an order which contains 3 different types of product. Products 1 and 2 are simply listed individualy based on a single supplier. Product 3 is listed as individual records within the table but numerous records are for the same item and I need to present these lines as a total number for that product rather than all the individual lines. I have tried to replicate the totalling of these individual items within report groups. The report works OK for items 1 and 2 but item 3 is printing out as individual records rather than item totals.
Can anyone help?
Keith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top