• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
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 353.7k 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.
  • P Offline
    Perlchamp
    last edited by May 2, 2020, 3:31 PM

    hi sam :-)
    see my module-file. why i don’t get values for the Log.log(); statements ?

    	// this is the major worker of the module, it provides the displayable content for this module
    	getDom: function() {
    		var self = this;
    		var wrapper = document.createElement("div");
    		Log.log("this.active_birthdays >>>>> ", this.active_birthdays);
    
    		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 May 2, 2020, 3:44 PM Reply Quote 0
    • S Offline
      sdetweil @Perlchamp
      last edited by sdetweil May 2, 2020, 3:48 PM May 2, 2020, 3:44 PM

      @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
      • P Offline
        Perlchamp
        last edited by May 2, 2020, 3:48 PM

        and where i have to place it ?

        S 1 Reply Last reply May 2, 2020, 3:49 PM Reply Quote 0
        • S Offline
          sdetweil @Perlchamp
          last edited by May 2, 2020, 3:49 PM

          @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
          • P Offline
            Perlchamp
            last edited by May 2, 2020, 3:52 PM

            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 May 2, 2020, 3:53 PM Reply Quote 0
            • S Offline
              sdetweil @Perlchamp
              last edited by sdetweil May 2, 2020, 3:55 PM May 2, 2020, 3:53 PM

              @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
              • P Offline
                Perlchamp
                last edited by May 2, 2020, 3:56 PM

                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 May 2, 2020, 3:57 PM Reply Quote 0
                • S Offline
                  sdetweil @Perlchamp
                  last edited by May 2, 2020, 3:57 PM

                  @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
                  • P Offline
                    Perlchamp
                    last edited by May 2, 2020, 3:59 PM

                    the columns are:
                    birth, name

                    and is called “birthdays.csv”

                    the data are:
                    23.01.1987,Thomas Roth

                    S 1 Reply Last reply May 2, 2020, 4:00 PM Reply Quote 0
                    • S Offline
                      sdetweil @Perlchamp
                      last edited by sdetweil May 2, 2020, 4:00 PM May 2, 2020, 4:00 PM

                      @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
                      • 1
                      • 2
                      • 14
                      • 15
                      • 16
                      • 17
                      • 18
                      • 31
                      • 32
                      • 16 / 32
                      16 / 32
                      • First post
                        151/313
                        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