Hi Roberto

Try this


static void Job5(Args _args)
{
    Query   eisQuery = new Query();
    InventTrans eisInventTrans;
    QueryRun    eisQueryRun;
    ;

    //eisInventTrans.Qty
    eisQuery.addDataSource(TableNum(InventTrans));
    eisQuery.dataSourceTable(TableNum(InventTrans)).orderMode(OrderMode::GroupBy);
    eisQuery.dataSourceTable(TableNum(InventTrans)).addSortField(fieldnum(InventTrans,TableId));
    eisQuery.dataSourceTable(TableNum(InventTrans)).addSelectionField(fieldnum(InventTrans,Qty),SelectionField::Sum);

    eisQueryRun = new QueryRun(eisQuery);

    while(eisQueryRun.next())
    {
        eisInventTrans =  eisQueryRun.get(tableNum(InventTrans)) ;
        print   eisInventTrans.Qty;
    }
    pause;


}

Vishal
>
>


> Hello to All
>
> Is there a way to make a query that gives the same
> result of doing:
>
> select sum(FieldX) from TableX where FieldY ==
> Something;
>
> The way i found goes like this, but I am sure that
> there should be a nicer way.
>
> Amount SumAmount;
> Query queryX;
> QueryRun queryrunX;
> TableX tableM;
>
> queryX = new Query(tablenum(TableX));
> queryX.dataSourceNo(1).addRange(fieldnum(TableX,
> FieldY)).value('Something');
> queryRunA = new QueryRun(queryA);
> while(queryRunA.next()){
>   tableM = queryRunA.getNo(1);
>   SumAmount += tableX.FieldX;
> }
>
> It's too slow.
> Thanks if somebody can help me.
>
> Roberto
>
> _________________________________________________________
> Do You Yahoo!?
> Informaci�n de Estados Unidos y Am�rica Latina, en Yahoo! Noticias.
> Vis�tanos en http://noticias.espanol.yahoo.com
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>





Yahoo! Groups Sponsor
ADVERTISEMENT
click here


Yahoo! Groups Links

Reply via email to