random with a dbf

random with a dbf

Postby Silvio » Sat Apr 15, 2006 4: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
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Antonio Linares » Sat Apr 15, 2006 5:02 pm

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42077
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Silvio » Sat Apr 15, 2006 10:34 pm

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

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

Postby Antonio Linares » Sat Apr 15, 2006 11:15 pm

FW/FWH
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42077
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Sakis » Sun Apr 16, 2006 2:38 am

Silvio

Try the folowing:

Code: Select all  Expand view

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
Sakis
 
Posts: 42
Joined: Fri Oct 21, 2005 2:12 pm
Location: Athens

Postby Silvio » Sun Apr 16, 2006 4: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
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Sakis » Sun Apr 16, 2006 6:39 pm

Hello Silvio again

Try the following :

Code: Select all  Expand view

FUNCTION Unique(nTotale)

RETURN( HB_RANDOMINT(1,nTotale))



Regards
Dionisis
User avatar
Sakis
 
Posts: 42
Joined: Fri Oct 21, 2005 2:12 pm
Location: Athens

Postby Silvio » Sun Apr 16, 2006 8:57 pm

thanks to all
Best Regards, Saludos

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], nageswaragunupudi and 78 guests