Uncaught ReferenceError: tableau is not defined

Uncaught ReferenceError: tableau is not defined

kishoreakishorea Posts: 2Questions: 1Answers: 0
edited July 2022 in Free community support

Hi,

I am getting Uncaught ReferenceError: tableau is not defined.

Please suggest.

Below is the code:

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

    // Define the schema
    myConnector.getSchema = function(schemaCallback) {
        var cols = [{
            id: "shipTo",
            alias: "shipTo",
            dataType: tableau.dataTypeEnum.string
        }, {
            id: "soldTo",
            alias: "soldTo",
            dataType: tableau.dataTypeEnum.string
        }, {
            id: "uid",
            alias: "uid",
            dataType: tableau.dataTypeEnum.string
        }];

        var tableSchema = {
            id: "earthquakeFeed",
            alias: "Order data",
            columns: cols
        };

        schemaCallback([tableSchema]);
    };

    // Download the data
    myConnector.getData = function(table, doneCallback) {
        $.getJSON("*****************", function(resp) {
            debugger;
            var feat = resp.customers;
            tableData = [];



            // Iterate over the JSON object
            for (var i = 0, len = feat.length; i < len; i++) {
                tableData.push({
                    "shipTo": feat[i].shipTo,
                    "soldTo": feat[i].soldTo,
                    "uid": feat[i].uid
                });
            }

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



    tableau.registerConnector(myConnector);



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

Edited by Kevin: Syntax highlighting. Details on how to highlight code using markdown can be found in this guide

Answers

  • kthorngrenkthorngren Posts: 20,304Questions: 26Answers: 4,769

    Its hard to say specifically without seeing the page but I suspect the problem is that you are referencing the tableau variable but it is not accessible within the context of where the error is occurring. This doesn't look like a Datatables specific issue or question. However if you want help debugging please post a link to your page so we can take a look.

    Kevin

  • kishoreakishorea Posts: 2Questions: 1Answers: 0
    edited July 2022

    Hi Kevin..Thanks for responding..
    We are trying to connect to API through webdataconnector from tableau

    here is the html code and below is the error log in tableau

    Storage>Cookies-and-see-more-details-at-https://www.chromestatus.com/feature/5088147346030592-and-https://www.chromestatus.com/feature/5633521622188032."}_____">Storage>Cookies-and-see-more-details-at-https://www.chromestatus.com/feature/5088147346030592-and-https://www.chromestatus.com/feature/5633521622188032."}_____">_____{"ts":"2022-07-18T03:10:24.005","pid":27236,"tid":"6bb8","sev":"info","req":"-","sess":"-","site":"-","user":"-","k":"web-data-connector","v":"http://*****:8888/apitestWDC.html:0 -- A cookie associated with a cross-site resource at http://gateway.zscloud.net/ was set without the SameSite attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with SameSite=None and Secure. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5088147346030592 and https://www.chromestatus.com/feature/5633521622188032."}_____

    HTML Code

    <html>
    <head>
    <title>Order data</title>
    <meta http-equiv="Cache-Control" content="no-store" />

    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" type="text/javascript"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
    
    <script src="https://connectors.tableau.com/libs/tableauwdc-2.3.latest.js" type="text/javascript"></script>
    <script src="./apitestWDC.js" type="text/javascript"></script>
    

    </head>

    <body>
    <div class="container container-table">
    <div class="row vertical-center-row">
    <div class="text-center col-md-4 col-md-offset-4">
    <button type = "button" id = "submitButton" class = "btn btn-success" style = "margin: 10px;">Get Orders Data!</button>
    </div>
    </div>
    </div>
    </body>
    </html>

  • colincolin Posts: 15,144Questions: 1Answers: 2,586

    It just seems that the tableau variable is out of scope at that point. It doesn't seem like a DataTable issue so may be worth asking on Tableau specific forum, or Stackoverflow,

    Colin

Sign In or Register to comment.