Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Compute many operations
Message
 
 
To
08/09/2004 14:22:31
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00939290
Message ID:
00940383
Views:
23
>hi,
>thank you very much
>it's ok. just step 3 ,not skip i must take this records
>
>thanks .
>
>best regards
>m.qasem

Ok, this piece needs to be changed:
lnNumberToExtract = curPercentage.NumToFetch
    lnAreaCode = curPercentage.AreaCode
    lnTeam = curPercentage.Team

   ** Now use code from Sergey Berezniker (Al Doman) - may be not efficient, but quite elegant
    SELECT TOP lnNumberToExtract *, RECNO() AS rn,  ;
   ROUND(RAND()*10000000000,0) AS ord ;
    FROM table1 ;
    WHERE AreaCode = m.lnAreaCode and Team = m.lnTeam ;
    ORDER BY ord ;
    INTO CURSOR crsRand
to the following:
lnAreaCode = curPercentage.AreaCode
lnTeam = curPercentage.Team

lnNumberToExtract = curPercentage.NumToFetch
if m.lnNumberToExtract<curPercentage.TeamCount    
   ** Now use code from Sergey Berezniker (Al Doman) - may be not efficient, but quite elegant
    SELECT TOP lnNumberToExtract *, RECNO() AS rn,  ;
   ROUND(RAND()*10000000000,0) AS ord ;
    FROM table1 ;
    WHERE AreaCode = m.lnAreaCode and Team = m.lnTeam ;
    ORDER BY ord ;
    INTO CURSOR crsRand
else && we exceed original number of records, just select all records for that team
   select * from table1 WHERE AreaCode = m.lnAreaCode and Team = m.lnTeam into cursor crsRand NOFILTER
endif
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform