-=> Erik Wachtmeester schreef op 26 Jun 97 07:22:00 aan Ron Tuynman over
Adding Fields in Clipper 5.2..<=-
RT> //---Detecting:
RT> aRay := DBSTRUCT ( "NAME.DBF" )
RT> log := .f.
RT> FOR d = 1 to LEN aRay
RT> IF "ADRESS" $ UPPER( aRay[ d ][ 1 ] )
RT> //---Log becomes true if a field named ADRESS exists
RT> log := .t.
RT> ENDIF
RT> NEXT
EW> Instead of the for/next loop I would use something like:
EW> log := ( ascan( aRay, { |x| x[1] = 'ADDRESS' } ) # 0 )
...Yep, but it's doesn't show as much what I'm actually doing as
FOR...NEXT. I like to keep it as simple as possible. Especially when
I'm explaining thing to someone else...
And furthermore: I think your code wouldn't work..;-) Oh, sorry it
would! Me myself I always use the '==' for comparison, not the soft
'='. With == it would never have found ADRESS1 as a fieldname...
Cu,
Ron
--- Blue Wave v2.12
---------------
* Origin: SYNCNET BBS - +31-35-6237178/6244318 [ISDN] (2:283/1)
|