FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Pocket PC Macro operator
Posts: 48
Joined: Sun Oct 30, 2005 09:29 AM
Macro operator
Posted: Tue Sep 21, 2010 08:44 PM
Hello all,

I have a table with various field named D10,D11,D12,D13, ...
I would like to update the fields in a loop using the macro operator.
Something similar to
Code (fw): Select all Collapse
LOCAL cFld := ""
LOCAL nInd := 0

FOR nInd := 10 TO 20
   cFld := "D" + Str(nInd,2)
   oTable:&cFld := nInd
NEXT


This doesn't seem to work.
Can someone tell me the syntax to be used?

Many thanks in advance,
Raymond
Raymond Fischbach
www.mouches.org
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Macro operator
Posted: Wed Sep 22, 2010 06:10 AM

Raymond,

__ObjSendMsg( oTable, "_" + cFld, nInd )

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 842
Joined: Mon Oct 10, 2005 01:29 PM
Re: Macro operator
Posted: Wed Sep 22, 2010 06:45 AM
Raymond,

Code (fw): Select all Collapse
FOR nInd := 10 TO 20
   cFld := "D" + Str(nInd,2)
   &(cFld) := nInd
NEXT

Maurizio
Posts: 48
Joined: Sun Oct 30, 2005 09:29 AM
Re: Macro operator
Posted: Wed Sep 22, 2010 10:14 AM
Thank you Antonio and Maurizio,

Antonio,
I did not try your solution because I asked only half of my problem and your solution works when I want to replace the value of a field but I still don't know how to retrieve the value of the field.

Maurizio,
Your syntax works perfectly.

This is my code now:
Code (fw): Select all Collapse
cFld := "D" + cDia
nTmp := oF10b:&(cFld)
nTmp ++
oF10b:&(cFld) := nTmp


Many thanks for this fast help,
Raymond
Raymond Fischbach
www.mouches.org
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Macro operator
Posted: Wed Sep 22, 2010 01:09 PM

Raymond,

To retrieve a data value don't use the "_":

MsgInfo( __ObjSendMsg( oTable, cFld ) )

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 48
Joined: Sun Oct 30, 2005 09:29 AM
Re: Macro operator
Posted: Sat Oct 02, 2010 08:41 PM

Thanks Antonio,
Raymond

Raymond Fischbach
www.mouches.org

Continue the discussion