Forum Discussion

Vinaydhi's avatar
Vinaydhi
Occasional Contributor
8 years ago
Solved

Search method of FarPoint Spread

Hi,

 

I am searching a text in farpoint spread sheet by using:

bwSpread.Search(0,"300100",true,true,true,false,3,0, foundRowID, foundColID);

 

I am not able to get any value in foundRowID, foundColID although defined text "300100" exist in the sheet.

 

Please help.

 

  • It looks like foundRowID and foundColID are by-reference parameters, and JScript/JavaScript do not support passing parameters by reference.

     

    A possible workaround is to install the OutParameterWrapper extension and call the Search method using this extension. In this case you should be able to get the values of by-reference parameters. The code would be like this:

    var params = [0, "300100", true, true, true, false, 3, 0, 0, 0]; // The last two 0's are foundRowID and foundColID
    params = ConvertJScriptArray(params); // function code can be found at https://support.smartbear.com/viewarticle/42197/
    var result = OutParameterWrapper.CallObjectMethod(bwSpread, "Search", params).toArray(); var foundRowID = result[8]; // 9th parameter of the Search method var foundColID = result[9]; // 10th parameter of the Search method

    I don't have any FarPoint Spread apps so I can't test this code, but I hope it gives you the idea.

4 Replies

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)

    It looks like foundRowID and foundColID are by-reference parameters, and JScript/JavaScript do not support passing parameters by reference.

     

    A possible workaround is to install the OutParameterWrapper extension and call the Search method using this extension. In this case you should be able to get the values of by-reference parameters. The code would be like this:

    var params = [0, "300100", true, true, true, false, 3, 0, 0, 0]; // The last two 0's are foundRowID and foundColID
    params = ConvertJScriptArray(params); // function code can be found at https://support.smartbear.com/viewarticle/42197/
    var result = OutParameterWrapper.CallObjectMethod(bwSpread, "Search", params).toArray(); var foundRowID = result[8]; // 9th parameter of the Search method var foundColID = result[9]; // 10th parameter of the Search method

    I don't have any FarPoint Spread apps so I can't test this code, but I hope it gives you the idea.

    • Vinaydhi's avatar
      Vinaydhi
      Occasional Contributor

      Thanks Helen Kosova. It worked !!! 

  • shankar_r's avatar
    shankar_r
    Community Hero

    I have not automated any FarPoint Spread but i can say based on the line pasted here,

     

    bwSpread.Search(0,"300100",true,true,true,false,3,0, foundRowID, foundColID);

     

    foundRowID, foundColID fields should be your input since when you call function you should be inputting all the parameters.

     

    So, Can you please share the error message and some screenshot of the object and all. it would be helpful if you share these

    • Vinaydhi's avatar
      Vinaydhi
      Occasional Contributor

      foundRowID and foundColID are reference variables which will store the row and column IDs if the given string is found in the sheet. Refer attachment "SearchReference.PNG".