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.

Unable to insert decimal integer values

devdev Members
edited November -1 in Sahi - Open Source
I am inserting some excel value into the application
Details as follow,
Excel sheet “From” column value is “0.2”
(Column format as text and add “ ‘ “ in front of the “0.2”.)

But it’s inserting value “2” into the application text fields.

What is the reason for that, how do I insert “0.2” instead of “2”?

Comments

  • Hi Dev,

    I am not sure what you are exactly looking for, but try below code it works fine with me -

    $db = _getDB("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=C:\\sahi\\userdata\\scripts\\Results.xls;readOnly=false","","");
    $db.update("insert into [SheetName$] (ExecutionResult) values('0.5')");
    $db.update("update [SheetName$] set Result='0.2' where ExecutionResult='TC01'");

    Let me know if there is still issue.
    -Ashish
  • I am facing the same. I tried to insert decimal number from array into the application textbox. Using the following code:

    var my_array = new Array();
    my_array[0] = "10";
    my_array[1] = "2.20";
    my_array[2] = 35;
    my_array[3] = 42;
    my_array[4] = 50;
    my_array[5] = 60;
    my_array[6] = "2.25";
    my_array[7] = "1.85";
    my_array[8] = "5.70";

    updateMarks(my_array);//Call function to provide inputs by array
    _click(_submit("Save"));
    _click(_span("Revathi V"));//Change User Name
    _click(_link("Logout"));
    function updateMarks($AddMarks){
    var $textboxes = _collect("_numberbox", "/.*/", _in(_div("marks_content")));
    for (var $i=0; $i<$textboxes.length; $i++) {
    // alert($textboxes[$i]);
    _setValue($textboxes[$i], $AddMarks[$i]);
    }
    }

Sign In or Register to comment.