random with a dbf

Post Reply
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

random with a dbf

Post by Silvio »

I have a dbf where there is a field ( codice)
how I can load an random number to load a record


Regards
Best Regards, Saludos

Falconi Silvio
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

You may use nRandom( <nRange> ) --> nValue to create random numbers.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

thanks antonio
but this func is of fw or harbour ?
Best Regards, Saludos

Falconi Silvio
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

FW/FWH
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Sakis
Posts: 41
Joined: Fri Oct 21, 2005 2:12 pm
Location: Athens

Post by Sakis »

Silvio

Try the folowing:

Code: Select all


FUNCTION  Unique()

LOCAL cNumeric:=   STR (HB_RANDOMINT(1,10000) ,5) 

// You may use any number instand of 10000

cNumeric := STRTRAN (cNumeric ," ","0")

RETURN( cNumeric)

 
Regards
Dionisis
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

thanks but I must create a random number from a file dbf
on the file dbf i have a numeric field ( codice) :

use IMG alias IMG
totale:= img->(reccount())
Number:=nRnadom(totale)
Go Number

have you another idea ?
Best Regards, Saludos

Falconi Silvio
User avatar
Sakis
Posts: 41
Joined: Fri Oct 21, 2005 2:12 pm
Location: Athens

Post by Sakis »

Hello Silvio again

Try the following :

Code: Select all


FUNCTION Unique(nTotale)

RETURN( HB_RANDOMINT(1,nTotale))

Regards
Dionisis
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

thanks to all
Best Regards, Saludos

Falconi Silvio
Post Reply