Forum Discussion

abrar22's avatar
abrar22
Frequent Contributor
7 years ago

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

  • tristaanogre's avatar
    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
    }