Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Limit Quary Returned Records

Status
Not open for further replies.

Rickinrsm

Technical User
Nov 3, 2004
130
US
This is what I'm trying to accomplish.

1.> Run this query.
2.> SORT in decending order.
3.> Select only the TOP 20 records in the sorted table to be used in additional calculating queries?

H. E. L. P!

Thanks much . . . Rick

q=

Query
ANSWER: :pRIV:AnswerTopOffices.DB

Coastal.DB | SalePrice | ListName |
| CALC SUM ALL AS SalePrice | Check |

EndQuery

if not q.executeQbe()then
errorShow()
return
endif
If Not tc.open(":pRIV:AnswerTopOffices") then
errorShow()
Return
endIf

Sort "AnswerTopOffices.db"
ON "SalePrice" D
EndSort
 
Don't open the tc before sorting.

After sorting (adding :pRIV:), do a

now open tc, then

for i from 1 to 20
tc.movetorecord(i)
; do what you need (20 queries?)
endfor


Tony McGuire
"It's not about having enough time. It's about priorities.
 
The for i from 1 to 20 continues to run the first set of 20 records until doomsday. I get hundreds of set of the first 20 records.

scan Toptc:
s=Toptc."ListName"
for i from 1 to 20
Toptc.movetorecord(i)
; do what you need (20 queries?) What I do from here is run additional queries that perform calculations based on the value of s.

I have the endFor at the end of the queries where many variable assignments are made for the value of s.

Where should endFor be placed?

Thanks much. I'm getting clcose I think. Rick
 
Tony . . . this works PERFECTLY!

Can't thank you enough.

Consider yourself highly appreciated!

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top