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.
Pass Variable to Function
in Sahi Pro
Hi
I want help with trying to pass some variables from one function to another.
so with the following example:
function exercise() {
fnLLR_Calculate();
fnLLR_Calculate2();
}
function fnLLR_Calculate() {
//
Get values from page
//
var $Shares;
_set($Shares, _getText(_textbox("CALC_STOCK_INPUT")));
$Shares = Number($Shares);
_log("$Shares =" + $Shares);
var $GrantPrice;
_set($GrantPrice, _getText(_textbox("GRANT_PRICE_INPUT")));
$GrantPrice = Number($GrantPrice);
_log("$GrantPrice = " + $GrantPrice);
var $FMVPrice;
_set($FMVPrice, _getText(_textbox("FAIR_MARKET_VALUE")));
$FMVPrice = parseFloat($FMVPrice).toFixed(2);
_log("$FMVPrice = " + $FMVPrice);
var $TaxWitholdRate;
_set($TaxWitholdRate, _getText(_textbox("TAX_WITHHOLDING_RATE")));
$TaxWitholdRate = $TaxWitholdRate / 100;
_log("$TaxWitholdRate = " + $TaxWitholdRate);
}
function fnLLR_Calculate2() {
$Result_Shares = ($Shares- $GrantPrice) * $TaxWitholdRate / $FMVPrice;
$Result_Shares = $Result_Shares.toFixed(0);
_log("$Result_Shares = " + $Result_Shares);
}
So i need to pass values from function fnLLR_Calculate to fnLLR_Calculate2.
What is the best way to do this?
I want help with trying to pass some variables from one function to another.
so with the following example:
function exercise() {
fnLLR_Calculate();
fnLLR_Calculate2();
}
function fnLLR_Calculate() {
//
Get values from page
//
var $Shares;
_set($Shares, _getText(_textbox("CALC_STOCK_INPUT")));
$Shares = Number($Shares);
_log("$Shares =" + $Shares);
var $GrantPrice;
_set($GrantPrice, _getText(_textbox("GRANT_PRICE_INPUT")));
$GrantPrice = Number($GrantPrice);
_log("$GrantPrice = " + $GrantPrice);
var $FMVPrice;
_set($FMVPrice, _getText(_textbox("FAIR_MARKET_VALUE")));
$FMVPrice = parseFloat($FMVPrice).toFixed(2);
_log("$FMVPrice = " + $FMVPrice);
var $TaxWitholdRate;
_set($TaxWitholdRate, _getText(_textbox("TAX_WITHHOLDING_RATE")));
$TaxWitholdRate = $TaxWitholdRate / 100;
_log("$TaxWitholdRate = " + $TaxWitholdRate);
}
function fnLLR_Calculate2() {
$Result_Shares = ($Shares- $GrantPrice) * $TaxWitholdRate / $FMVPrice;
$Result_Shares = $Result_Shares.toFixed(0);
_log("$Result_Shares = " + $Result_Shares);
}
So i need to pass values from function fnLLR_Calculate to fnLLR_Calculate2.
What is the best way to do this?