Ask a Question

Adding variable to namemapping

abrar22
Frequent Contributor

Adding variable to namemapping

Hi All

 

I am passing the parameters in the function and use that in the namemapping. Val1 is working but when using val2 its not getting the value from that property. Is this the correct way to Concat( Highlighted in red) ?

 

function FXConnectBookedDataFwdClientAllIn(val1,val2)
{
val1= aqConvert.VarToInt(val1);
var val = vGetPropertyVal(WGrd_NetDataGrid.Items.Item(0).Forwards.Item(0).Item(val1)+"."+val2,'Value')
return val
}

1 REPLY 1
tristaanogre
Esteemed Contributor

val2 in your code example will not be evaluated so that it's value will be part of the object itself.  You need to evaluate the object first.  See the code below. EDIT: found a slight typo.

 

 

function FXConnectBookedDataFwdClientAllIn(val1,val2)
{
val1= aqConvert.VarToInt(val1);
var object = eval('WGrd_NetDataGrid.Items.Item(0).Forwards.Item(0).Item(' + val1 + ').' + val2)
var val = vGetPropertyVal(object,'Value')
return val
}

 


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
cancel
Showing results for 
Search instead for 
Did you mean: