FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour random with a dbf
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
random with a dbf
Posted: Sat Apr 15, 2006 04:27 PM

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
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
random with a dbf
Posted: Sat Apr 15, 2006 05:02 PM

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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
random with a dbf
Posted: Sat Apr 15, 2006 10:34 PM

thanks antonio
but this func is of fw or harbour ?

Best Regards, Saludos



Falconi Silvio
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
random with a dbf
Posted: Sat Apr 15, 2006 11:15 PM

FW/FWH

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 42
Joined: Fri Oct 21, 2005 02:12 PM
random with a dbf
Posted: Sun Apr 16, 2006 02:38 AM
Silvio

Try the folowing:

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
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
random with a dbf
Posted: Sun Apr 16, 2006 04:32 PM

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
Posts: 42
Joined: Fri Oct 21, 2005 02:12 PM
random with a dbf
Posted: Sun Apr 16, 2006 06:39 PM
Hello Silvio again

Try the following :

FUNCTION Unique(nTotale)

RETURN( HB_RANDOMINT(1,nTotale))


Regards
Dionisis
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
random with a dbf
Posted: Sun Apr 16, 2006 08:57 PM

thanks to all

Best Regards, Saludos



Falconi Silvio

Continue the discussion