Concatenate a varible into a method call ( new problem )

Concatenate a varible into a method call ( new problem )

Postby Rick Lipkin » Fri May 27, 2011 5:15 pm

Gale or Daniel

I am having difficulty once again creating a code block .. this time inserting a parameter into a method

//Here is the method line that works 'hard coded'
//IE:Document:Forms:oc:Item(x):GetAttribute("type")

cSSBD := "Document:Forms:oc"
cNode_name := "type"

bSSBD := &( [ { | IE | IE:]+cSSBD+[:length]+[ } ] )
nCOUNT := eval( bSSBD, IE ) // 9

Code: Select all  Expand view

For x=0 to nCount

 try
 *cRICK := IE:Document:Forms:oc:Item(x):GetAttribute("type") // hard coded ok
 * bRICK := &( [ { | IE | IE:]+cSSBD+[:Item(x):GetAttribute("TYPE")]+[ } ] ) // works
   // both fail below
   bRICK := &( [ { | IE | IE:]+cSSBD+[:Item(x):GetAttribute("]+cNode_name+[)"]+[ } ] )
   bRICK := &( [ { | IE | IE:]+cSSBD+[:Item(x):GetAttribute(]+cNODE_NAME+[)]+[ } ] )
   cRICK := eval( bRICK, IE )
 catch
    x++
    loop
 end try

 msginfo( cRICK+str(x) )
 if lower( cRICK ) = lower( cNODE_VALUE )
    IE:Document:Forms:oc:Item(x):Click() // work on this
    lFOUND := .T.
    EXIT
 Endif

Next
 


I am having difficulty inserting cNode_name ("type") as a parameter into the GetAttribute( ) .. I keep getting cNode_name as undefined ??

I am sure I am just struggling with the correct syntax .. I would appreciate your help once again ..

Regards
Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Concatenate a varible into a method call ( new problem )

Postby Gale FORd » Fri May 27, 2011 7:31 pm

One thing it looks like this line has error in the last quote location to make the macro correct.
bRICK := &( [ { | IE | IE:]+cSSBD+[:Item(x):GetAttribute("]+cNode_name+[)"]+[ } ] )
should be
bRICK := &( [ { | IE | IE:]+cSSBD+[:Item(x):GetAttribute("]+cNode_name+[")]+[ } ] )
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: Concatenate a varible into a method call ( new problem )

Postby Rick Lipkin » Sat May 28, 2011 2:07 pm

Gale

Thank you .. your solution worked !

Appreciate your help
Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 95 guests