Forum Discussion

sudhir_optima's avatar
sudhir_optima
Contributor
14 years ago

How to pass array as function parameters

We have written a function which accepts array value.



function  SelectMultipleGridvalues(RowIndex,ColumnName)

{

Aliases.QBIS.GrpBox.grdControl.ClickCell (RowIndex[0],ColumnName);

for ( var i=1;i<RowIndex["length"];i++)

Aliases.QBIS.GrpBox.grdControl.ClickCell (RowIndex,ColumnName,skCtrl);

}



We are calling this function by passing the values as



RunScriptRutine    SelectMultipleGridvalues        (2,5,6),Revenue



But when we run it it just click first row four times ?



Will any one tell me why this is happening
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    I'm not sure, but I think the "ClickCell" method for most grid objects expects integers, not strings.  So, it may simply, because it cannot convert the values to integers, be just clicking 0,0 each time.
  • tinauser's avatar
    tinauser
    Frequent Contributor
    RunScriptRutine    SelectMultipleGridvalues        (2,5,6),Revenue


    Are you calling the script from a KWDT: How are you passing the array?
  • Yes, I am passing the array values through Keyword script.



    As mention the function accepts two values array values ( The grid index like, 2,3,...) and column name ( In this cases 'Revenue')



    The objective of this function is i want to create a generic function on any grid column. Where we can select any grid values by passing index and name of the column.
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Again, as I mentioned, ClickCell uses, I believe, numeric indices only.  To pass in a string with the column name will not work.  What happens if you call "ClickCell" using the numeric equivalent to the column?