18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
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.
Not is numeric
Hi guys,
I am having another problem with the not is numeric function:
_set($terminal_number, parseInt($data[5][1]));
if (_condition(!_IsNumeric($terminal_number))){
_log("Network Terminal Number must be numeric", "failure");
}
Returns the following error:
_sahi.saveCondition("__lastConditionValue__2", !_IsNumeric(2))
TypeError: Object expected
No trace available
Please help
Thanks,
I am having another problem with the not is numeric function:
_set($terminal_number, parseInt($data[5][1]));
if (_condition(!_IsNumeric($terminal_number))){
_log("Network Terminal Number must be numeric", "failure");
}
Returns the following error:
_sahi.saveCondition("__lastConditionValue__2", !_IsNumeric(2))
TypeError: Object expected
No trace available
Please help
Thanks,
Comments
parseInt() will not continue parsing when facing an alphanumeric number:
var $a= parseInt("1234")
$a = 1234
var$b =parseInt("12X34)
$b=12
var $c= parseInt("Foo")
c$ is NaN
i hope that helps you.
Regards
Wormi
I am using the following function, seems to work now, not too sure why it did not with the parseInt() function
function IsNumeric($sText){
var $ValidChars = "0123456789.";
var $IsNumber=true;
var $Char;
for (var $i = 0; $i < $sText.length && $IsNumber == true; $i++){
$Char = $sText.charAt($i);
if ($ValidChars.indexOf($Char) == -1) {
$IsNumber = false;
}
}
return $IsNumber;
}
Thanks,