I think this must be really basic but I’m having trouble. I made a button for each calculation I need. And in the final page I want to get all the results sum all and divide by another variable. But I can’t use the results from other functions…
I’ve tried to define them as 0 before all functions, and it only works for one of the results.
I have something like this with more code in each function
let Result1=0
let Result2=0
let Result3=0
…
export function button1_click (event){
…
let Result1=etc
$w(“#text27”).text = Result1.toString()
}
export function button2_click (event){
…
let Result2=etc
$w(“#text31”).text = Result2.toString()
}
…
export function button8_click (event){
let NP=$w(“#dropdown34”).value
let Final=(Result1+Result2+Result3+Result4+…)/NP
$w(“#text44”).text=Final.toString()
}
Final is always equal to Result2/NP its the only one I can get because the other results remain 0 even though they’ve all been defined inicialy as 0. I don’t know why, how can I define the Results so I can use them all in Final?