complicated calculation

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
Hubertus
Posts: 153
Joined: Sat Feb 11, 2006 2:11 pm
Location: Austria
Contact:

complicated calculation

Post by Hubertus »

I have Delivery --> Order --> OrderDetails <-- Product (--> means 1:N)
I need to summarize the amount from OrderDetails by Product for a whole Delivery. With these amounts (1 for every product) I'd need to calculate ceiling(sum/1000). And finally I need to sum up the results from the ceiling function calls and place it into Delivery

Can this be done with AwareIM ? :shock:

Thanks a lot for any hints,
Hubertus
aware_support2
Posts: 595
Joined: Sun Apr 24, 2005 2:22 am
Contact:

Post by aware_support2 »

Hubertus,

You need to add a non-persistent object DeliveryProduct and a rule to object Delivery with the following actions:

FIND Product WHERE EXISTS OrderDetails WHERE (OrderDetails.Order.Devlivery = Delivery AND OrderDetails.Product = Product)

FOR EACH Product CREATE DeliveryProduct WITH DeliveryProduct.Delivery = Delivery, DeliveryProduct.CeilingTotal = CEILING(SUM OrderDetails.Total WHERE (OrderDetails.Order.Devlivery = Delivery AND OrderDetails.Product = Product) / 1000)

Delivery.CeilingTotal = SUM DeliveryProduct.CeilingTotal WHERE (DeliveryProduct.Delivery = Delivery)
Aware IM Support Team
Hubertus
Posts: 153
Joined: Sat Feb 11, 2006 2:11 pm
Location: Austria
Contact:

Post by Hubertus »

wow, thanks !
I was expecting a hint, not a solution 8)
Post Reply