vijay

The performance hit I think would be higher in a bash script.  I think there
is no question about that.

But, if you insist

List purchaseOrders = delegator.findByAnd("OrderHeader",
UtilMisc.toMap("orderTypeId","PURCHASE_ORDER"));
if(!UtilValidate.isEmpty(purchaseOrders))
{
        ...
        while(interator.hasNext())
        {
                ...
                double amount = 0;
                Double dAmount = order.getDouble("grandTotal");
                if(dAmount != null)
                {
                        amount = dAmount.doubleValue();
                }
                mytotal += amount;
                mycount++;
        }
}

Each of these class calls uses reflection.
Better to write this in java if it will be used lots.

Better still to use the view entity that Jonathon suggested.

Skip


-----Original Message-----
From: vijay Si [mailto:[EMAIL PROTECTED]
Sent: Saturday, September 15, 2007 9:11 AM
To: [email protected]
Subject: Re: Accessing database through bsh script.


Hi Jonathon,

i cannot use the view-entity for querrying, as it would cause a performance
hit. Is there any other method to get the above querry. Do u know of any
ways to do it through bsh script.


Regards


On 9/15/07, Jonathon -- Improov <[EMAIL PROTECTED]> wrote:
>
> Use the GenericDelegator and related classes, I think. Or maybe not. I
> can't recall the aggregate
> functions there.
>
> The entity definitions do have those, though. The <view-entity>? Oh yes,
> the <view-entity>.
>
> Try using DynamicViewEntity to construct a <view-entity>.
>
> Jonathon
>
>  Si wrote:
> > Is there any funtionality provided for using aggregate functions
> > (sum,min,max..) and count()  for querrying to data base through bsh.
> >
> > for egg: how can we write following in BSH :
> >
> > Select sum(order_id),sum(grand_total) from order_header  where
> > order_type_id="PURCHASE_ORDER";
> >
> > Regards
> >
> >
> >
> > ------------------------------------------------------------------------
> >
> > No virus found in this incoming message.
> > Checked by AVG Free Edition.
> > Version: 7.5.487 / Virus Database: 269.13.19/1008 - Release Date:
> 9/14/2007 8:59 AM
>
>

Reply via email to