18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

Facing the Problem when I am trying to udpate the values in Excel Shee

ravillaravilla Members
edited November -1 in Sahi - Open Source
Hi ,


When I use the below script I am able to update the value in excel>expense tab> Expense column.

db.update("update [expense$] set Actor = '8888' "); Worked perfectly for this script.


My Problem: Now I want to replace the the fixed value '8888" with some variable to use in Script.



var $Ref = _getText(_textbox(5))

_alert($Ref);

In alert I am getting the textbox(5) value.


Now I want to use the Variable ($Ref) in my db.update script.


These are formats I tried and nothing is working please suggest me the solution.


//db.update("update [expense$] set Expense = ''+$Ref+''");
//db.update("update [expense$] set Expense = '$Ref' ");
//db.update("update [expense$] set Expense=(eval("'"+$Ref+"'"))");
//db.update("update [expense$] set Expense = $Ref ");
//db.update("update [expense$] set Expense=(eval("'"+$expref+"'"))");

Regards
Anil kumar Ravilla

Comments

  • narayannarayan Administrators
    db.update("update [expense$] set Expense = '''+$Ref+"'");

    It is

    db.update(<dq>update [expense$] set Expense = <sq><dq>+$Ref+<dq><sq><dq>);

    <dq> is double quotes
    <sq> is single quotes

    Regards,
    Narayan
  • Hello Narayan,

    When am using this script am getting the function name in the excel instead of value of the variable

    In excel it is update the Expense column with the below text
    _sahi._getText(_sahi._textbox(5))


    Please suggest me

    Regards,
    Anil Ravilla
  • narayannarayan Administrators
    Hi,

    Looks like you are using a slightly older version of Sahi.

    Instead of

    var $Ref = _getText(_textbox(5));

    do

    var $Ref;
    _set($Ref, _getText(_textbox(5)));

    Regards,
    Narayan
  • Hello Narayan,

    Thanks for your Immediate response and it is working fine.



    Regards
    Anil Kumar Ravilla
This discussion has been closed.