Macro operator

Macro operator

Postby Raymond Fischbach » Tue Sep 21, 2010 8: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: Select all  Expand view

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
User avatar
Raymond Fischbach
 
Posts: 48
Joined: Sun Oct 30, 2005 9:29 am
Location: Belgium

Re: Macro operator

Postby Antonio Linares » Wed Sep 22, 2010 6:10 am

Raymond,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Macro operator

Postby Maurizio » Wed Sep 22, 2010 6:45 am

Raymond,

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

Maurizio
User avatar
Maurizio
 
Posts: 824
Joined: Mon Oct 10, 2005 1:29 pm

Re: Macro operator

Postby Raymond Fischbach » 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: Select all  Expand view
cFld := "D" + cDia
nTmp := oF10b:&(cFld)
nTmp ++
oF10b:&(cFld) := nTmp
 


Many thanks for this fast help,
Raymond
Raymond Fischbach
www.mouches.org
User avatar
Raymond Fischbach
 
Posts: 48
Joined: Sun Oct 30, 2005 9:29 am
Location: Belgium

Re: Macro operator

Postby Antonio Linares » Wed Sep 22, 2010 1:09 pm

Raymond,

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

MsgInfo( __ObjSendMsg( oTable, cFld ) )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Macro operator

Postby Raymond Fischbach » Sat Oct 02, 2010 8:41 pm

Thanks Antonio,
Raymond
Raymond Fischbach
www.mouches.org
User avatar
Raymond Fischbach
 
Posts: 48
Joined: Sun Oct 30, 2005 9:29 am
Location: Belgium


Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 9 guests