title: looping over data needing to display vertical columns for 3 years only showing months that contain data
body: <p>If every month of the past 3 years contained data, then this working example fiddle is how I need the data to look</p>
  
  <p><a href="https://jsfiddle.net/bthorn/ncqn0jwy/" rel="nofollow noreferrer">https://jsfiddle.net/bthorn/ncqn0jwy/</a></p>
  
  <p>HOWEVER, I don't always have data in a given month and thus i am to not show the month if it contains no data</p>
  
  <p>This is a fiddle of me trying to loop over the data</p>
  
  <p><a href="https://jsfiddle.net/bthorn/2zkhk3dt/1/" rel="nofollow noreferrer">https://jsfiddle.net/bthorn/2zkhk3dt/1/</a></p>
  
  <p>I am first trying to loop over the years to get distinct years, </p>
  
  <pre><code>for (var y in data) {
     if (typeof(uniqueYears[data[y].year]) === "undefined") {
       distinctYears.push(data[y].year);
  
        year = data[y].year;
          if (year === "" || year === null) {
             year = "";
          }
  
       strResult += "&lt;th style='text-align:left;'&gt;&lt;h2&gt;" + year + "&lt;/h2&gt;&lt;/th&gt;";
       //console.log(year);
  
  
       uniqueYears[data[y].year] = 0;
  
  
     }
  }
  </code></pre>
  
  <p>Then I loop over the months and I pay attention to the loop of the years , but I realized that this is not right at all since every row needs to be taking into consideration the year and month ,  </p>
  
  <p>So the data object "data" contains the data, but I'm not understanding how to mesh my data (2nd fiddle) into the year/month fiddle (1st fiddle)   </p>
  
  <p>I did even try to do a call into a function that loops over all my data with each of the outputs for the year month fiddle, but It seems to only show August 2015 for some reason and I did a ton of console.log </p>
  
  <p><strong>Update</strong></p>
  
  <p>Essentially the first fiddle is like this </p>
  
  <p>(however, my data only has files in a folder for 4 months in 2015)  thus those would appear but the others I would show as blank ""  )  </p>
  
  <p><a href="https://i.stack.imgur.com/qxVpg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qxVpg.png" alt="enter image description here"></a></p>
  
  <p>Update 2:</p>
  
  <p>So the output of my data with my year and month loops are clearly not right at all see pic
  <a href="https://i.stack.imgur.com/KwoB3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KwoB3.png" alt="enter image description here"></a></p>
  
  <p><strong>Update 3</strong></p>
  
  <p>Third fiddle shows that I create a function to call into and loop over my data to be checking if the data matches up ,  sadly it is only returning August 2015  on a match</p>
  
  <p><a href="https://jsfiddle.net/bthorn/rsu7mxbm/" rel="nofollow noreferrer">https://jsfiddle.net/bthorn/rsu7mxbm/</a></p>