tableau / webdataconnector

Bring the data you care about into Tableau
https://tableau.github.io/webdataconnector
MIT License
681 stars 585 forks source link

Can not figure out why this webconnector isn't working #138

Closed BACMac closed 7 years ago

BACMac commented 7 years ago

I can't figure out why this is not working. I'm getting no errors, but its returning no data. I'm just starting out with the connector, so I'm sure its something simple in the Java.

Here is my Java (function() {

var myConnector = tableau.makeConnector();

myConnector.getSchema = function(schemaCallback) { var cols = [ { id: "Name", alias: "Name", dataType: tableau.dataTypeEnum.string }, { id: "Email", alias: "Email", dataType: tableau.dataTypeEnum.string }, { id: "ID", alias: "ID", dataType: tableau.dataTypeEnum.string } ];

var tableInfo = {
    alias: "User Group Data",
    id: 'UserGroupData',
    columns: cols
};

schemaCallback([tableInfo]);

};

myConnector.getData = function(table, doneCallback) { var connectionUrl = "http://shared.shared.com/sites/MSR/RA/BI Pages/Untitled_1.html";

var xhr = $.ajax({
  url: connectionUrl,
  success: function (response) 
    {
      var stockTableRows = $(response).find('#twenty tr');
      stockTableRows = stockTableRows.not(':first'); // Removes the first row which is the header

      var tableData = [];
      stockTableRows.each(function (i, row) 
        {

            var $stockTableColumnsInRow = $(row).find('td');

            // Build a row from the parsed response
            tableData.push({
              'Name':  $($stockTableColumnsInRow[0]).text(),
              'Email': $($stockTableColumnsInRow[1]).text(),
              'ID':    $($stockTableColumnsInRow[2]).text()
            });
        });

     table.appendRows(tableData);
     doneCallback();
    // tableau.dataCallback(tableData, "", false);
    }
});

};

tableau.registerConnector(myConnector); })();

$(document).ready(function(){ $("#submitButton").click(function() { // This event fires when a button is clicked tableau.connectionName = 'SharePoint List Query'; tableau.submit(); }); });

julienvs commented 7 years ago

Hi BACMac,

Not sure I'm looking at the right thing here but worth a shot: is your connectionUrl correct? It seems there's a weird space between BI and Pages: var connectionUrl = "http://shared.shared.com/sites/MSR/RA/BI Pages/Untitled_1.html";

BACMac commented 7 years ago

it's right and even if I put %20 between the two parts, I'm getting the same effect.

julienvs commented 7 years ago

Ok, and what about the prefix:

BACMac commented 7 years ago

Its an internal site, so the WWW is not needed.

lbrendanl commented 7 years ago

Closing for lack of activity, please reopen if needed.