MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    read csv-data and put it in an array

    Scheduled Pinned Locked Moved Utilities
    313 Posts 3 Posters 446.2k Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      sdetweil @Perlchamp
      last edited by sdetweil

      @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..
      

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      1 Reply Last reply Reply Quote 0
      • PerlchampP Offline
        Perlchamp
        last edited by

        and where i have to place it ?

        S 1 Reply Last reply Reply Quote 0
        • S Offline
          sdetweil @Perlchamp
          last edited by

          @Perlchamp see my updated post above

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 0
          • PerlchampP Offline
            Perlchamp
            last edited by

            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: {}

            S 1 Reply Last reply Reply Quote 0
            • S Offline
              sdetweil @Perlchamp
              last edited by sdetweil

              @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

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              1 Reply Last reply Reply Quote 0
              • PerlchampP Offline
                Perlchamp
                last edited by

                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 ?

                S 1 Reply Last reply Reply Quote 0
                • S Offline
                  sdetweil @Perlchamp
                  last edited by

                  @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

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  1 Reply Last reply Reply Quote 0
                  • PerlchampP Offline
                    Perlchamp
                    last edited by

                    the columns are:
                    birth, name

                    and is called “birthdays.csv”

                    the data are:
                    23.01.1987,Thomas Roth

                    S 1 Reply Last reply Reply Quote 0
                    • S Offline
                      sdetweil @Perlchamp
                      last edited by sdetweil

                      @Perlchamp so there are no birthdays for today… we are ONLY selecting for TODAY. not every day

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      1 Reply Last reply Reply Quote 0
                      • PerlchampP Offline
                        Perlchamp
                        last edited by

                        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;
                        	}
                        
                        S 1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 17
                        • 18
                        • 19
                        • 20
                        • 21
                        • 31
                        • 32
                        • 19 / 32
                        • First post
                          Last post
                        Enjoying MagicMirror? Please consider a donation!
                        MagicMirror created by Michael Teeuw.
                        Forum managed by Sam, technical setup by Karsten.
                        This forum is using NodeBB as its core | Contributors
                        Contact | Privacy Policy