ASCAN on 2 colums

ASCAN on 2 colums

Postby Marc Vanzegbroeck » Mon Dec 09, 2019 7:38 pm

Hi,

Is it possible to do a array-search where for example the first column = 'TEST' and the seconds column = 'TEST1'?
I also want to search on the upper-case, but the problem is that sometimes the value = nil, so I get an error with upper.
The array is comming from an excel-file read with
Code: Select all  Expand view  RUN
 oRange   := oSheet:UsedRange
arr = ArrTranspose( oRange:Value) 
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: ASCAN on 2 colums

Postby Jimmy » Mon Dec 09, 2019 8:47 pm

hi,
Marc Vanzegbroeck wrote:Is it possible to do a array-search where for example the first column = 'TEST' and the seconds column = 'TEST1'?
I also want to search on the upper-case, but the problem is that sometimes the value = nil, so I get an error with upper.
The array is comming from an excel-file read with
Code: Select all  Expand view  RUN
 oRange   := oSheet:UsedRange
arr = ArrTranspose( oRange:Value) 

just a Idea to use a function, not tested

Code: Select all  Expand view  RUN
   cSeek := "ABC"
   nElement := AScan( aArray, ;  
                      {|a,i| Test(a,i,cSeek) },;
                      nStart )

FUNCTION Test(a,i,cSeek)
LOCAL nPosi := 0
   IF EMPTY(a[1])
      RETURN -1
   ENDIF
   IF EMPTY(a[2])
      RETURN -1
   ENDIF
   // compare as you need
   IF cSeek $ a[1] .OR. cSeek $ a[2]
      nPosi := i
   ENDIF
RETURN nPosi
 
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: ASCAN on 2 colums

Postby nageswaragunupudi » Tue Dec 10, 2019 3:34 am

Code: Select all  Expand view  RUN
nAt := AScan( arr, { |a| Upper( IfNil( a[ 1 ], "" ) ) = "TEST" .and. ;
                         Upper( IfNil( a[ 2 ], "" ) ) = "TEST1" } )
Regards

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], Otto and 89 guests