Please note that Sahi's development and support teams do not actively monitor this. This is more a community forum. If you are a Sahi Pro user looking for commercial support, please email support @ with your query.

Pass Variable to Function


I want help with trying to pass some variables from one function to another.

so with the following example:

function exercise() {



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?
Sign In or Register to comment.