I would do that a little differently. For one thing I would use a
single replace command for the entire table and not one per column.

LOCAL ;
        laFields[1], liLoop as Integer, lcCmd as String, llFound as Boolean
CLOSE DATABASES ALL
USE los
llFound = .F.
lcCmd = "REPLACE "
FOR liLoop = 1 TO AFIELDS(laFields,"los")
       IF NOT INLIST(LOWER(laFields[m.liLoop,1]),"groupid", "stuname", "stunum",
       "inadate", "rta", "los_pk", "rowguid", "importdate", "location",
       "createdate", "createtime", "modidate", "moditime") ;
       AND INLIST(laFields[m.liLoop,2],"N","I") THEN
               lcCmd = m.lcCmd + laFields[m.liLoop,1] + " WITH 9999,"
               llFound = .T.
       ENDIF
ENDFOR
IF m.llFound
        *Drop the final comma
        lcCmd = LEFT(m.lcCmd,LENC(m.lcCmd)-1)
        &lcCmd. ALL IN LOS
ENDIF

HTH

Mike Yearwood
Microsoft MVP 2008 - Visual FoxPro


> Message: 2
> Date: Wed, 25 Feb 2009 17:15:44 -0500 (EST)
> From: "MB Software Solutions General Account"
>        <[email protected]>
> Subject: RE: What's the command for getting array of object props?
> To: [email protected]
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset="us-ascii"
>
> On Wed, February 25, 2009 4:57 pm, Richard Kaye wrote:
>> I'd probably use a FOR.. loop. Something like:
>>
>>
>> ****untested code...
>> m.MyNewValue=9999 FOR EACH thing IN loRec
>> IF VARTYPE(thing)=[N]
>> loRec.thing=m.MyNewValue ENDIF
>> NEXT
>
>
> Yeah, this is what I ended up doing (quick and dirty):
>
> LOCAL laFields(1), liCnt as Integer, liLoop as Integer, lcCmd as String
> CLOSE DATABASES ALL
> USE los
> liCnt = AFIELDS(laFields,"los")
> FOR liLoop = 1 TO liCnt
>        IF NOT INLIST(LOWER(laFields(liLoop,1)),"groupid", "stuname", "stunum",
> "inadate", "rta", "los_pk", "rowguid", "importdate", "location",
> "createdate", "createtime", "modidate", "moditime") AND
> INLIST(laFields(liLoop,2),"N","I") THEN
>                lcCmd = [REPLACE ] + laFields(liLoop,1) + " WITH 9999 ALL IN 
> LOS"
>                &lcCmd
>        ENDIF
> ENDFOR
>
>
> Worked perfectly.  Thanks to everyone for chiming in.

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to