Jain Suvienay
|
| Posted: 04/25/2005, 12:47 AM |
|
Hi,
I am using the same structure as the OrderEntry example in the CCSexample pack.
I have created a new page and used the grid builder to create a grid of records of all the entries in the store_orders_items table so that Ican view all the products ordered in one go.
The main fields in the grid are:
order no., order date, product, quantity, price. (retrieved from orders,order_items tables)
I have added a new field to the grid total to which I have assigned the label totalvalue. in the before show event I have added the following to calculate the value of the totalvalue field
store_orders_items.totalvalue.value = store_orders_items.quantity.value * store_orders_items.price.value
This way the field is automatically populated with the value of the goods.
It is working perfectly fine so far.
However now I want a list of the total value of ALL the orders also.
I tried to use the help file which gave Simple report with total help (refer to help file)
I added new td with field called summ with the show before value calculated as
store_orders_items.summ.value = store_orders_items.summ.value + store_orders_items.totalvalue.value
(as i want the sum total of the totalvalue field for all the orders)
A value is being displayed BUT it contains ONLY the last value of the totalvalue row and not the sum total of all the totalvalue rows
Why is this?
example:
quantity price totalvalue
12 10 120
10 3 30
12 2 24
summ 24
As you can see the summ is being displayed as only 24 and not 174. Why is this?
Is it because the totalvalue is being dynamically generated and not stored anywhere? The summ label is only taking the last generated value of totalvalue
Even if that is the case, there must be a way to find the sum total?
Please let me know
Thanks
|
|
|
 |
erat
|
| Posted: 07/07/2005, 12:06 AM |
|
Hi,
You can try this
Just put this code
store_orders_items.summ.value = store_orders_items.summ.value + store_orders_items.totalvalue.value
inside the same quote/function where you coded
store_orders_items.totalvalue.value = store_orders_items.quantity.value * store_orders_items.price.value
Hv a nice day!
|
|
|
 |
|