search a number of on array

search a number of on array

Postby Silvio.Falconi » Fri May 27, 2022 8:13 pm

I have an array created with

AaDd(aFrequeMax[nRuota],{massimo, &num})

then I have a number for a sample 42 and the nWheel 1

I must found the number 42 on aFrequeMax [nWheel] and return me the second element of this array

How I must make it ?

I tried with
AEval( aData, { |a| If( (a[1] = numero ), nFrequenza:=a[2] , nil ) } )
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6893
Joined: Thu Oct 18, 2012 7:17 pm

Re: search a number of on array

Postby Antonio Linares » Fri May 27, 2022 8:43 pm

Dear Silvio,

Please provide a drawing or something to better understand you :-)
regards, saludos

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

Re: search a number of on array

Postby Silvio.Falconi » Fri May 27, 2022 9:47 pm

Antonio Linares wrote:Dear Silvio,

Please provide a drawing or something to better understand you :-)


sample nWheel = 1

Image


I have to find out if my number is in the first column, if it found it, return the value for the second column

For a sample my number is 66 it must return 594
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6893
Joined: Thu Oct 18, 2012 7:17 pm

Re: search a number of on array

Postby nageswaragunupudi » Sat May 28, 2022 6:59 pm

Code: Select all  Expand view
function ArrLookUp( aArray, nSeek )

   local nAt
   
   if ( nAt := AScan( aArray, { |a| a[ 1 ] == nSeek } ) ) > 0
      return aArray[ nAt, 2 ]
   endif
   
return nil
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10465
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: search a number of on array

Postby Silvio.Falconi » Sat May 28, 2022 7:30 pm

thanks
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6893
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], jair and 96 guests