select top 4 records

I want to select and return top 4 rows of a table in a report in nav. how?

Just use an integer variable to keep a counter of how many records you have retrieved. You can use your standard FINDFIRST / FINDSET functions and REPEAT…UNTIL loop to go through the data.

but I want the top 4 records sorted by some key and not the first 4 records. I want the top 4 customers with highest sales

screaming replaced with lower case by moderator

you can see: financial management - receivable - reports - top __ customer list.
design the report, and learn how it is written.

Pavan, please stop posting in all caps. It looks like you are screaming, and it is considered to be rude

you can use SETRANGE /SETFILTER to filter the records with highest sales of top 4 customers. hope this one help you