title: Creating Tableau WDC from associative array
body: <p>I am creating a Tableau Web Data Connector as described in their <em>Getting Started</em> guide <strong><a href="https://tableau.github.io/webdataconnector/docs/wdc_tutorial" rel="nofollow noreferrer">HERE</a></strong>.</p>
  
  <p>I have implemented a similar solution previous with data from a basic associative array, but I am having trouble with my current API call.</p>
  
  <p>I make an API call to an external web service that returns a JSON similar to the one listed below (simplified version)(<strong>COMMENT</strong> simply added for clarity and not part of original code).</p>
  
  <pre><code>{
      "status": true,
      "employee": {
          "id": 123
      },
      "company": {
          "id": 123
      },
      "job": {
          "id": 123,
          "job_workflows": [{
              "id": 1,
              "name": "Start",
              "action_value_entered": "Start"
          }, {
              "id": 2,
              "name": "Date",
              "action_value_entered": "2017-09-11"
          }, {
              "id": 3,
              "name": "Crew",
              "action_value_entered": "Crew 3"
          },
          **COMMENT** - 17 other unique fields - omitted for brevity
          ]
      }
  }
  </code></pre>
  
  <p>For my requirements, I need to create a new column for each of my JSON <strong><em>job_workflows</em></strong> to display the data in Tableau. I.e.  </p>
  
  <ul>
  <li>Column 1 Header = Start</li>
  <li>Column 1 value = Start</li>
  <li>Column 2 Header = Date Complete</li>
  <li>Column 2 value = 2017-09-11</li>
  </ul>
  
  <p>Etc.</p>
  
  <p>My Tableau JavaScript file looks as below:</p>
  
  <pre><code>(function () {
      var myConnector = tableau.makeConnector();
  
      myConnector.init = function(initCallback) {
          initCallback();
          tableau.submit();
      };
  
      myConnector.getSchema = function (schemaCallback) {
          var cols = [
              { id : "start", alias : "Start", dataType: tableau.dataTypeEnum.string },
              { id : "date", alias : "Date", dataType: tableau.dataTypeEnum.datetime },
              { id : "crew", alias : "Crew", dataType: tableau.dataTypeEnum.string }
          ];
  
          var tableInfo = {
              id : "myData",
              alias : "My Data",
              columns : cols
          };
  
          schemaCallback([tableInfo]);
      };
  
      myConnector.getData = function (table, doneCallback) {
      $.getJSON("http://some/api/call/data.php", function(response) {
              var resp = response; // Response is JSON as described above
              var tableData = []; 
  
              // Iterate over the JSON object
              for (var i = 0, len = feat.length; i &lt; len; i++) {
                  // not working
                  tableData.push({
                      "start": resp.job.job_workflows[i].action_value_entered,
                      "date": resp.job.job_workflows[i].action_value_entered,
                      "crew": resp.job.job_workflows[i].action_value_entered
                  });
              }
  
              table.appendRows(tableData);
              doneCallback();
          });
      };
  
      tableau.registerConnector(myConnector);
  })();
  </code></pre>
  
  <p>How do I iterate over the JSON <strong><em>job_workflow</em></strong> and assign each <strong><em>action_value_entered</em></strong> to be a <strong><em>id</em></strong> in my <strong><em>getSchema()</em></strong> function? My current version simply <em>hangs</em> and no values are returned. NO error or warnings thrown.</p>