You could simplify your code in many parts. For instance you code this
if (!flow.get('tagCounts')) {
flow.set('tagCounts', {});
}
const tagCounts = flow.get('tagCounts');
which could easily be changed to this:
let tagCounts = flow.get('tagCounts') || {};
In 'function 6-delete' you have
const resetValues = true; // Variable zum Zurücksetzen der Werte
if (resetValues) {
flow.set('tagCounts', {}); // Setze die Tag-Zählungen zurück
flow.set('dataArray', []); // Setze das Datenarray zurück
}
msg.payload = []; // Leeres Array für die Table-Node-Daten
return msg;
the first two lines are not needed. You could change the code to:
//reset the flow variables
flow.set('tagCounts', {}); // Setze die Tag-Zählungen zurück
flow.set('dataArray', []); // Setze das Datenarray zurück}
msg.payload = []; // Leeres Array für die Table-Node-Daten
return msg;
You should also read up on 'var, let and const' NOTE: const variables can neither be updated nor re-declared.