Simple Calculation Error

Hello and thank you in advance!

I am making a super simple calculation on a page and my calculations are not showing. In PREVIEW mode I am getting an error (but it looks unrelated). All the rest of the code on the page is working fine.

I think I need to import a library for performing math calculations , but I can’t find a reference to one anywhere.

THE PAGE: https://www.tevixmd.com/cashimpactcalculator
ALL OF THE CODE:


$w.onReady(function () {
});

export function button10_click(event, $w) {
 //Add your code for this event here: 
 var totPatients = Number($w("#iTotalPatients").value);
 var cashDaily = totPatients * 15;
 var cashMonthly = cashDaily * 20;
 var cashAnnually = cashMonthly * 12;
    $w("#tDailyData").text = cashDaily;
    $w("#tMonthlyData").text = cashMonthly;
    $w("#tAnnuaData").text = cashAnnually;
    $w("#tDaily").show();
    $w("#tDailyData").show();
    $w("#tMonthly").show();
    $w("#tMonthlyData").show();
    $w("#tAnnual").show();
    $w("#tAnnuaData").show();
}

Any ideas? Thank you again! Cynthia- : -)

I think I figured it out!!!

I need to convert the result (a number) to a string before displaying it on the screen. YAY!!!


$w("#tDailyData").text = String(cashDaily);
$w("#tMonthlyData").text = String(cashMonthly);
$w("#tAnnuaData").text = String(cashAnnually);