hello Lars;
sorry to say u r not fulfilling the requirements of the Roberto's problem.
i think u need to the requirement.
solution sent by visal is ok.
what u think
regards
Nitesh
----- Original Message -----
From: "Lars Holm" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, March 11, 2005 2:37 PM
Subject: RE: [development-axapta] Question about Queries.
Try something like this (example on custtrans)
query = new Query();
qbds = query.addDataSource(tablenum(CustTrans));
qbds.addRange(fieldnum(CustTrans, Accountnum)).value('test');
qbds.addSortField(fieldnum(CustTrans, AccountNum));
qbds.orderMode(OrderMode::GroupBy);
qbds.addSelectionField(fieldnum(custTrans, AmountMST),
SelectionField::Sum);
queryRun = new QueryRun(query);
while (queryRun.next())
{
custTrans = queryRun.get(tablenum(CustTrans));
info(strfmt("Balance for customer '%1': %2", custTrans.AccountNum,
custTrans.AmountMST));
}
Br,
Lars
-----Original Message-----
From: Roberto Pineda [mailto:[EMAIL PROTECTED]
Sent: 10. marts 2005 18:02
To: [email protected];
[email protected]
Subject: [development-axapta] Question about Queries.
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 Links
----------------------------------------------------------------------------
----
>
> email-body was scanned and no virus found
>
| Yahoo! Groups Sponsor | |
|
|
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/development-axapta/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

