Tableau API

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

Steve James
Ebase User
Posts: 331
Joined: Mon Mar 10, 2014 8:34 am

Tableau API

#1

Postby Steve James » Mon Jul 04, 2016 8:40 am

Hi, I am trying to get Ebase to work with Tableau's API. Tableau is a world leading Business Intelligence offering. Has anyone any experience of it?

http://onlinehelp.tableau.com/current/a ... h%3D_____3


It's the first time we've tried using another package (other than a few Java ones) and (rightly or wrongly) I've put the Java file in C:\ebaseXi_5.1.0\UfsClient\IntegratedServer\ebasetest\WEB-INF\lib

I know these are being checked and the script gets past these lines.

When I attempt to initialize the api I get an "Could not initialize class com.tableausoftware.extract.ExtractAPI" error

Code: Select all

ExtractAPI.initialize();
After a bit of investigating I 'think' I need to point Tomcat at the lib files (ie add to the classpath). Excuse my ignorance of Java but it's all good practice.

I'm trying this on a local 5.1.1 copy of Ebase.

It would be brilliant if we can get this up and running as we can build data extracts dynamically.

Thanks
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#2

Postby Jon » Mon Jul 04, 2016 8:58 am

Steve,

I haven't come across this API before, but it would be unusual to add a jar file to tomcat/lib (this is tomcat's classpath as opposed to the ebase webapp's classpath) and I wouldn't expect it to work. Does the exception give you any more detail? Have you checked the server logs?

Jon
0 x

Steve James
Ebase User
Posts: 331
Joined: Mon Mar 10, 2014 8:34 am

#3

Postby Steve James » Mon Jul 04, 2016 11:07 am

Hi I've got it working.

I read some documentation that stated the executable needed to be on the os path, I guess that's what lead me to think I needed to add to the classpath. Thanks for the clarification about the tomcat/lib.

Anyway I added the application onto the os path and added some extra dll files to the same place (I've not seen any reference to the dlls anywhere but the error linked to the file name) and I'm up and running.

Thanks
0 x

Dave
Ebase Staff
Posts: 89
Joined: Mon Sep 10, 2007 11:48 am

#4

Postby Dave » Wed Jul 06, 2016 11:38 am

Hi Steve - could you share what you did? we will then create something to put into the Vault for anyone else wanting to use Tableau.

Thanks!

Dave
0 x

Steve James
Ebase User
Posts: 331
Joined: Mon Mar 10, 2014 8:34 am

#5

Postby Steve James » Wed Jul 06, 2016 12:40 pm

Hi Dave.

We are evaluating Tableau at the moment but I'm quite impressed at the online content. I've managed to answer pretty much all my queries. Getting the SDK up and running was relatively painless (especially as I'm not overly Java friendly).

I downloaded the Tableau API from https://onlinehelp.tableau.com/current/ ... h%3D_____3

This page contains the links for the downloads. I downloaded "Tableau SDK for C/C++/Java (64-bit)" as I'm running 5.1.1 64bit Ebase.

I copied the 4 jar files from the 'Java' folder of the SDK download to 'C:\ebaseXi_5.1.0\UfsClient\IntegratedServer\ebasetest\WEB-INF\lib'

I added the Tableau Desktop bin folder ie 'C:\Program Files\Tableau\Tableau 9.3\bin\' into the path of my PC.

I compared the contents of 'bin' folder in the SDK download to the 'bin' folder of my Tableau Desktop and found most files existed; although they were subtly different ** todo check if the newer files should have been copied across.

I copied 3 dlls from the 'bin' folder of the SDK download to the Desktop 'bin' folder (TableauCommon.dll; TableauExtract.dll; TableauServer.dll)

A restart of Ebase then allowed me to use the Tableau SDK.

A simple script to create a TDE file (Tableau Data Extract). Rough and ready to prove the point

Code: Select all

importPackage(com.ebasetech.xi.api);
importPackage(com.ebasetech.xi.services);
importPackage(com.tableausoftware.common);
importPackage(com.tableausoftware.extract);

//https://onlinehelp.tableau.com/current/api/sdk/en-us/SDK/C++/html/index.html

var a = "START<br>";

try
&#123;
	a = a + "pre initialize";
	ExtractAPI.initialize&#40;&#41;;
	a = a + "<br>initialized";

	var file = "c&#58;/saj.tde";
	var fn = services.file.existsFile&#40;file&#41;;
	if &#40;fn == true&#41;
	&#123;
		services.file.deleteFile&#40;file&#41;;
	&#125;
	
	var TDEextract = com.tableausoftware.extract.Extract&#40;file&#41;;
	
	var tableDef = new TableDefinition&#40;&#41;;
	a = a + "<br>defined tabledef";
	
	tableDef.addColumn&#40;"rowID",Type.CHAR_STRING&#41;;
	tableDef.addColumn&#40;"value",Type.DOUBLE&#41;;
	a = a + "<br>defined tablecolumns";
	var tbl = TDEextract.addTable&#40;'Extract',tableDef&#41;;
	a = a + "<br>table added";
	
	var newrow = com.tableausoftware.extract.Row&#40;tableDef&#41;;
	for &#40;i=0;i<100;i++&#41;
	&#123;
		newrow.setCharString&#40;0,'saj'+i&#41;;
		newrow.setDouble&#40;1,i&#41;;		
		tbl.insert&#40;newrow&#41;;
		a = a + ".";
	&#125;

	TDEextract.close&#40;&#41;;

&#125;
catch &#40;e&#41;
&#123;
	log&#40;e&#41;;
	a = a + "<br><br>## error --- " + e;
&#125;
finally
&#123;
	ExtractAPI.cleanup&#40;&#41;;
	event.getOwner&#40;&#41;.addErrorMessage&#40;a&#41;;
&#125;

A simple script to publish a data source (ie the TDE) to Tableau Server. Rough and ready to prove the point

Code: Select all

importPackage&#40;com.ebasetech.xi.api&#41;;
importPackage&#40;com.ebasetech.xi.services&#41;;
importPackage&#40;com.tableausoftware.common&#41;;
importPackage&#40;com.tableausoftware.server&#41;;

var a = '';
try
&#123;
	ServerAPI.initialize&#40;&#41;;
	a = a + 'initialized<br>';
	var sc = ServerConnection&#40;&#41;;
	a = a + 'connected<br>';

	sc.connect&#40;'&#91;http&#58;//Tableauserver&#93;','&#91;user&#93;','&#91;password&#93;',''&#41;;
	a = a + 'connected<br>';
	sc.publishExtract&#40;'&#91;c&#58;/fileName.tde&#93;','&#91;user&#93;','&#91;DataSourceName&#93;',true&#41;;
	a = a + 'published<br>';

	sc.disconnect&#40;&#41;;
	a = a + 'disconnected<br>';
	sc.close&#40;&#41;;
&#125;
catch&#40;e&#41;
&#123;
	a = a + 'Error - ' + e + '<br>';
&#125;
finally
&#123;
	ServerAPI.cleanup&#40;&#41;;
	a = a + 'published<br>';
	event.getOwner&#40;&#41;.addErrorMessage&#40;a&#41;;
&#125;

Thanks
0 x


Who is online

Users browsing this forum: No registered users and 6 guests