Fixed, I lost a bit of time to understand but the end I arrived in this way, ie declaring the variables in a global and not just within the function. I hope it is the best way, if someone sees that I’m wrong I ask to be able to correct myself.
let index = null;
let idRows = null;
let AttivoRows = null;
let NameRows = null;
function buttomActivated() {
$w(" #TabEventi “).onRowSelect( (event) => {
index = event.rowIndex;
idRows = event.target.rows[index]._id;
AttivoRows = event.rowData.attivo;
NameRows = event.rowData.nomeEventoOErimonia;
if (AttivoRows === null) {
$w(” #serviceActivate “).disable();
$w(” #serviceActivate “).label = ‘-’;
$w(’ #serviceName ‘).hide();
}else {
$w(’ #serviceName ‘).text = NameRows;
$w(’ #serviceName ').show();
$w(” #serviceActivate “).enable();
if (AttivoRows === true) {
$w(” #serviceActivate “).label = ‘Disattiva’;
AttivoRows = false;
}else {
$w(” #serviceActivate ").label = ‘Attiva’;
AttivoRows = true;
}
}
});
}
Thank you