1 Reply Latest reply on Sep 4, 2018 1:04 AM by James Dey

    Can not pull in Column descriptions via Tableau 10.2 WDC

    James Dey

      Hi all,

       

        I'm not a tableau user but am trying to write a web data connector to pull in table/column information (with an associated connection) in to Tableau Desktop.

       

        From the tableau debugger, I can see that the description is being correctly set for both tables and columns  in the tableSchema object prior to the schemaCallback[tableSchema]) command being executed.

       

      From Tableau desktop, I can see the tableSchema.description from the DataSource tab by hovering over the Table.

       

      However, when I hover over the column name, it just gives me the tablename.columname(tablename).  i.e. no column description is visible. From the Worksheet, I only see the connection rather than the tablename. When I hover over a dimension or measure, it is only showing me columnname(tablename). No column description is shown. When I right click and choose "Default Properties"->"Comment", there is no entry for the column description.

       

      According to the WDC API Reference , it should be possible to pull in the column description.

       

      I've amended the Examples/js/earthquakeUSGS.js script provided in the Tableau WDC SDK to demonstrate the issue. You can start Tableau from the command line using "tableau -DDebugWDC" to pull up the debugger which will show that the tableSchema object is correctly populated prior to the SchemaCallback being executed. The table description and column alias work fine, just not the column description:-

      (function() {
          // Create the connector object
          var myConnector = tableau.makeConnector();

          // Define the schema
          myConnector.getSchema = function(schemaCallback) {
              var cols = [{
                  id: "id",
                  dataType: tableau.dataTypeEnum.string,
                  alias: "This should prove that you can pull in column alias"
              }, {
                  id: "mag",
                  alias: "magnitude",
                  dataType: tableau.dataTypeEnum.float,
                  description: "This should prove that you can pull in a description by using a description"
              }, {
                  id: "title",
                  alias: "title",
                  dataType: tableau.dataTypeEnum.string,
                  description: "This should prove that you can pull in a column description"
              }, {
                  id: "lat",
                "description": "This is the distance east/west from the Greenwich meridian",
                  alias: "latitude",
                  dataType: tableau.dataTypeEnum.float
              }, {
                  id: "lon",
                  alias: "longitude",
                  dataType: tableau.dataTypeEnum.float,
                  description: "Why isn't this working?"
              }];

              var tableSchema = {
                  id: "earthquakeFeed",
                  description: "This should prove that you can pull in a table description",
                  columns: cols
              };

              schemaCallback([tableSchema]);
          };

          // Download the data
          myConnector.getData = function(table, doneCallback) {
              $.getJSON("https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/4.5_week.geojson", function(resp) {
                  var feat = resp.features,
                      tableData = [];

                  // Iterate over the JSON object
                  for (var i = 0, len = feat.length; i < len; i++) {
                      tableData.push({
                          "id": feat[i].id,
                          "mag": feat[i].properties.mag,
                          "title": feat[i].properties.title,
                          "lon": feat[i].geometry.coordinates[0],
                          "lat": feat[i].geometry.coordinates[1]
                      });
                  }

                  table.appendRows(tableData);
         tableau.log(table);
                  doneCallback();
              });
          };

          tableau.registerConnector(myConnector);

          // Create event listeners for when the user submits the form
          $(document).ready(function() {
              $("#submitButton").click(function() {
                  tableau.connectionName = "USGS Earthquake Feed"; // This will be the data source name in Tableau
                  tableau.submit(); // This sends the connector object to Tableau
              });
          });
      })();

       

      Message was edited by: James Dey