How to use firstonly10, firstonly100 keywords in select statement.

Hi all,

Can any tell me how to use firstonly10 in select statement. i tried but not working.

select firstonly10 sum(AmountCur) from custTrans order by TransDate;

{

info(strfmt(’%1’,custTrans.AmountCur));

}

You are using aggregation function with out any group by, it results a single value

Use while select when using firstonly10 or firstonly100

Example:

while select firstonly10 sum(AmountCur) custTrans group by TransDate

{

//info here

}

Hi Kranthi,

Thanks for your response.

i tried this code now. but it is giving sum of all records instead of only10 records

I think i misunderstood you. So you want sum for only first 10 records?

OK, it may not work the way you are expecting being there is no group by, so it gets all the records sum.

The query i have given, gives the first 10 days and their sum

for your scenario you may need something like this,

while select firstOnly10 AmountCur,TransDate from custTrans order by TransDate

{

// do sum here

info(strFmt("%1 - %2", custTrans.TransDate, custTrans.AmountCur));

}