2 Replies Latest reply on Sep 22, 2018 10:37 AM by Man Tsui

    Interaction between Tableau dashboard and Java script api

    Yogesh Gonnade

      Hi,

       

      I was trying to set the parameter from Javascript API and send that value to tableau dashboard and it should function accordingly.

       

      If i have a parameter in my tableau dashboard then i want to set its value through Javascript code but getting some error

       

      Javascript Code Sample 1:

      viz.getWorkbook().activateSheetAsync("Sheet 46").then(function (sheet) {

        worksheet = sheet;

      })

      // Single value

      .then(function () {

      1. console.log('It came inside');

        return worksheet.applyFilterAsync("Roll Up Region Parameter", "JP",

      tableau.FilterUpdateType.ADD);

      }, function (err) { /* ignore errors */ })

      .otherwise(function (err) {

        console.log(err);

      });

       

      Error:

       

      Error: Roll Up Region Parameter

          at Function.tab._TableauException.create (eval at <anonymous> (jquery-1.11.0.min.js:3), <anonymous>:147:58)

          at Function.tab._WorksheetImpl.$15 (eval at <anonymous> (jquery-1.11.0.min.js:3), <anonymous>:253:237)

          at eval (eval at <anonymous> (jquery-1.11.0.min.js:3), <anonymous>:257:29)

          at $4 (eval at <anonymous> (jquery-1.11.0.min.js:3), <anonymous>:46:66)

          at tab.JavaScriptApi$1.$7 (eval at <anonymous> (jquery-1.11.0.min.js:3), <anonymous>:44:562)

          at tab.VizImpl.delegate [as $12] (eval at <anonymous> (jquery-1.11.0.min.js:3), <anonymous>:6:409)

          at tab.VizImpl.$4E (eval at <anonymous> (jquery-1.11.0.min.js:3), <anonymous>:215:2694)

          at tab.VizImpl.$54 (eval at <anonymous> (jquery-1.11.0.min.js:3), <anonymous>:218:126)

          at tab.VizImpl.handleEventNotification (eval at <anonymous> (jquery-1.11.0.min.js:3), <anonymous>:206:1755)

          at tab.JavaScriptApi$1.$9 (eval at <anonymous> (jquery-1.11.0.min.js:3), <anonymous>:45:364)

       

       

      JavaScript Code Sample 2:

      viz.getWorkbook().activateSheetAsync("Sheet 46").then(function (sheet) {

        worksheet = sheet;

      })

      // Single value

      .then(function () {

      1. console.log('It came inside');

        return worksheet.applyFilterAsync("Roll Up Region Parameter", "JP",

      tableau.FilterUpdateType.REPLACE);

      }, function (err) { /* ignore errors */ })

      .otherwise(function (err) {

        console.log(err);

      });

       

      Error:

       

      VM19632:6 It came inside

      1. tab._PromiseImpl {then: ƒ}

      VM19632:11 Error: Roll Up Region Parameter

          at Function.tab._TableauException.create (eval at <anonymous> (jquery-1.11.0.min.js:3), <anonymous>:147:58)

          at Function.tab._WorksheetImpl.$15 (eval at <anonymous> (jquery-1.11.0.min.js:3), <anonymous>:253:237)

          at eval (eval at <anonymous> (jquery-1.11.0.min.js:3), <anonymous>:257:29)

          at $4 (eval at <anonymous> (jquery-1.11.0.min.js:3), <anonymous>:46:66)

          at tab.JavaScriptApi$1.$7 (eval at <anonymous> (jquery-1.11.0.min.js:3), <anonymous>:44:562)

          at tab.VizImpl.delegate [as $12] (eval at <anonymous> (jquery-1.11.0.min.js:3), <anonymous>:6:409)

          at tab.VizImpl.$4E (eval at <anonymous> (jquery-1.11.0.min.js:3), <anonymous>:215:2694)

          at tab.VizImpl.$54 (eval at <anonymous> (jquery-1.11.0.min.js:3), <anonymous>:218:126)

          at tab.VizImpl.handleEventNotification (eval at <anonymous> (jquery-1.11.0.min.js:3), <anonymous>:206:1755)

          at tab.JavaScriptApi$1.$9 (eval at <anonymous> (jquery-1.11.0.min.js:3), <anonymous>:45:364)

       

       

      Please help me on this to resolve this issue.

       

      Thanks for the help.