1 Reply Latest reply on Feb 14, 2017 11:03 AM by Patrick A Van Der Hyde

    Tableau Desktop Cross db join not working

    Gowsikan Boopathy

      Am new to Tableau, My task is to take a report by joining mongodb data with mysql data. When i looking for the solution i found that in tableau i can do that. I connect a mongodb to tableau using quasar api and Web Data Connector(an option in tableau). Now i can fetch data from mongodb in tableau but when i attempt to join with mysql table even though there are data in both table i can't see any result. 

       

      Following is the JS method used in Web Data Connector

       

       (function () {       var myConnector = tableau.makeConnector();        myConnector.getSchema = function (schemaCallback) {            var cols = [{                      id : "userid",                      alias : "",                      dataType : tableau.dataTypeEnum.float                 }, {                      id : "storeid",                      alias : "",                      dataType : tableau.dataTypeEnum.float                 }, {                      id : "status",                      alias : "",                      dataType : tableau.dataTypeEnum.string                 },            ];             var tableInfo = {                 id : "oid_store",                 alias : "Check for store",                 columns : cols            };             schemaCallback([tableInfo]);       };        myConnector.getData = function (table, doneCallback) {             var url = "http://localhost:20223/query/fs?q=";            var query = "select userid,storeid,status from `/storedata/stores`";             $.ajax({                 "url" : url + encodeURIComponent(query),                 "headers" : {                      "Accept" : "application/json"                 },                 "success" : function (resp) {                      // alert(JSON.stringify(resp));                      var feat = resp,                      tableData = [];                       // Iterate over the JSON object                      for (var i = 0, len = feat.length; i < len; i++) {                           var orderitems = feat[i].orderitems;                           tableData.push({                                 "userid" : feat[i].userid,                                "storeid" : feat[i].storeid,                                "status" : feat[i].status                            });                      }                      table.appendRows(tableData);                      doneCallback();                 }            });       };        tableau.registerConnector(myConnector);        $(document).ready(function () {            $("#submitButton").click(function () {                 tableau.connectionName = "Stores";                 tableau.submit();            });       });  })();
      

       

      I want to join storeid from mongodb to storeid in Mysql table. The datatype of storeid in Mysql table is BIGINT. That is why i gave tableau.dataTypeEnum.float dataType to storeid web data connector schema.

       

       

      Can someone help me on this?

       

      (function () { var myConnector = tableau.makeConnector();
      myConnector.getSchema = function (schemaCallback) { var cols = [{ id : "userid", alias : "", dataType : tableau.dataTypeEnum.float }, { id : "storeid", alias : "", dataType : tableau.dataTypeEnum.float }, { id : "status", alias : "", dataType : tableau.dataTypeEnum.string }, ];
      var tableInfo = { id : "oid_store", alias : "Check for store", columns : cols };
      schemaCallback([tableInfo]); };
      myConnector.getData = function (table, doneCallback) {
      var url = "http://localhost:20223/query/fs?q="; var query = "select userid,storeid,status from `/storedata/stores`";
      $.ajax({ "url" : url + encodeURIComponent(query), "headers" : { "Accept" : "application/json" }, "success" : function (resp) { // alert(JSON.stringify(resp)); var feat = resp, tableData = [];
      // Iterate over the JSON object for (var i = 0, len = feat.length; i < len; i++) { var orderitems = feat[i].orderitems; tableData.push({
      "userid" : feat[i].userid, "storeid" : feat[i].storeid, "status" : feat[i].status
      }); } table.appendRows(tableData); doneCallback(); } }); };
      tableau.registerConnector(myConnector);
      $(document).ready(function () { $("#submitButton").click(function () { tableau.connectionName = "Stores"; tableau.submit(); }); }); })();