in this opportunity I have a small requirement that I have not been able to carry out.
I have a database girl structured in this way;
in AP
a data will be loaded every day, which will always occupy the last positions obviously, I need that this last data also be loaded go to the instance SA
.
Try something like this;
AP.on('value',(snap)=>{
let ap_val = snap.val();
let ap_val_l = ap_val.length -1;
SA.push(ap_val[ap_val_l]);
});
where through the event on
then every time you change AP
in this case in the daily load of the last item, with push
add it to SA
which is my purpose. and it really works, the problem is that every time the page loads it does this task, and it is not the objective.
What I need is that every time that AP
is modified, the new data is loaded to SA
only once and so to the next day again when AP
the daily data is loaded.