Read the statement by Michael Teeuw here.
read csv-data and put it in an array
-
@Perlchamp said in read csv-data and put it in an array:
for(var birthday of Object.keys(this.active_birthdays)) { for(var name of this.active_birthdays[birthday]) {
that means one of those two for loops didn’t execute, as the list is empty
do this
// tell MM to call and get our content Log.log(JSON.stringify(this.active_birthdays)) // add this line self.updateDom(); // before this line in the notification code..
-
and where i have to place it ?
-
@Perlchamp see my updated post above
-
i get this for each entry (here i only posted one of them):
[2020-05-02 17:50:36.803] [LOG] LOOK >>>>>>{} (/home/dirk/MagicMirror/modules/MMM-Logging/node_helper.js:34 Class.socketNotificationReceived)
empty: {}
-
@Perlchamp ok, so the data collection didn’t work…
so I would step thru that code
what is the 1st row of your csv file? the column headers
-
before you do this. stop. i make an error. the code you posted is not in the notification section. it’s in the getDom section … so i placed it there. was this wrong ?
-
@Perlchamp there is NOT an this. updateDom() in the getDom() section…
still doesn’t change the result… there are no birthdays found that match 02/05
-
the columns are:
birth, nameand is called “birthdays.csv”
the data are:
23.01.1987,Thomas Roth -
@Perlchamp so there are no birthdays for today… we are ONLY selecting for TODAY. not every day
-
why for TODAY ? and not for current MONTH ?
getDon:getDom: function() { var self = this; var wrapper = document.createElement("div"); // tell MM to call and get our content Log.log("LOOK >>>>>>" + JSON.stringify(this.active_birthdays)) // add this line self.updateDom(); // before this line in the notification code.. for(var birthday of Object.keys(this.active_birthdays)) { for(var name of this.active_birthdays[birthday]) { var m = document.createElement("div"); Log.log("BIRTHDAY >> " + birthday); Log.log("NAME >> " + name); m.innerText = birthday + " " + name; wrapper.appendChild(m); } } // pass the created content back to MM to add to DOM. return wrapper; }