aggiunti try-catch error sulla query e controllo sul valore undefined

This commit is contained in:
Luca Trupiano 2022-10-21 14:56:48 +02:00
parent 5896481f4d
commit b87fe4b1d0
1 changed files with 43 additions and 32 deletions

View File

@ -456,6 +456,7 @@ $(document).ready(function() {
$('#resultsId1').empty();
$('#resultsId1').addClass("small pb-2")
$("#risultatitesto").empty();
try {
bindingsStream.on('data', (binding) => {
//console.log(binding.toString()); // Quick way to print bindings for testing
//console.log(binding.has('sub')); // Will be true
@ -464,7 +465,12 @@ $(document).ready(function() {
$("#risultatitesto").append(latestResult);
resultTablePart4 = '<tr><th scope="row" class="text-muted">' + rowNum++ + '</th>';
for (var i = 0; i < queryFields.length; i++) {
resultTablePart4 = resultTablePart4 + '<td class="text-muted">' + binding.get(queryFields[i]).value + "</td>";
if ( binding.get(queryFields[i]) != null){
val = binding.get(queryFields[i]).value
} else {
val = "na"
}
resultTablePart4 = resultTablePart4 + '<td class="text-muted">' + val + "</td>";
};
resultTable = resultTable + resultTablePart4 + '</tr>';
$("#loader").hide();
@ -488,6 +494,11 @@ $(document).ready(function() {
$('<label class="input-group-text"><ion-icon name="copy"></ion-icon></label>').insertBefore(buttonDiv);
},300);
});
}
catch(err) {
console.log(err.message);
$("#loader").hide();
};
};
// Funzione di creazione del tab delle clausole grammaticali