Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Random records from many area
Message
From
05/09/2006 05:11:14
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Miscellaneous
Thread ID:
01150681
Message ID:
01150844
Views:
26
hi,
thank you very much, it works...yes this what i want.
about Nice idea of indexing on RAND(), this not my idea or code

to be honest i got it form Mr. Fabio Lunardon.

thank you both again.

have a nice time.

regards.
m.qasem


>>hi all,
>>i need help to mdify at this code under ,
>>my filed name is(code) have numbers form 1 to 14
>>
>>for i= 1 to 3
>>1.i need to get 900 records randomly for every code
>>2.for i=4, i need 750 records randomly
>>3.for i=5 to 14, i need 450 records randomly for every code
>
>>
>>CLOSE all
>>USE RIS_SEG_2
>>
>>total = "450"
>>*total = (THISFORM.TEXT1.VALUE)
>>RAND(-1)
>>INDEX ON RAND() TO SYS(2023)+'\RANDOM'
>>*COPY TO \SELECTION NEXT &total
>>COPY TO rf2 NEXT &total
>>brow
>>SET INDEX TO
>>ERASE SYS(2023)+'\RANDOM'
>>      CLEAR EVENTS
>>
>> thanks
>
>Nice idea of indexing on RAND(), hopefully it is random enough.
>If I understand correctly your question, then how about:
>
>use RIS_SEG_2
>copy stru to RIS_RANDOMS
>use RIS_RANDOMS in 0
>nNextAmt=900
>for i = 1 to 15
>   if i = 4
>     loop
>   endif
>   if i =5
>     nNextAmt=450
>   endif
>   index on rand() to \random for fieldcode=i
>   set order to random
>   copy to \temprand next &nNextAmt
>   sele RIS_RANDOMS
>   appe from \temprand
>   sele RIS_SEG_2
>   set order to
>next
>index on rand() to \random for fieldcode=4
>set order to random
>copy to \temprand next 750
>sele RIS_RANDOMS
>appe from \temprand
>sele RIS_SEG_2
>set order to
>erase \temprand.dbf
>erase \random.idx
Previous
Reply
Map
View

Click here to load this message in the networking platform