FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour search a number of on array
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
search a number of on array
Posted: Fri May 27, 2022 08: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 March-April 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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: search a number of on array
Posted: Fri May 27, 2022 08:43 PM

Dear Silvio,

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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: search a number of on array
Posted: Fri May 27, 2022 09:47 PM
Antonio Linares wrote:Dear Silvio,

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


sample nWheel = 1




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 March-April 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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: search a number of on array
Posted: Sat May 28, 2022 06:59 PM
Code (fw): Select all Collapse
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
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: search a number of on array
Posted: Sat May 28, 2022 07:30 PM

thanks

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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

Continue the discussion