Jump to content

Hi, Does Document.Data.Tables["mytable"].Columns (ironPython) exist in javascript? i try the library spotfireAPI and i'm still loose. If someone can explain, or have a good documentation, i hope you have the time to answer. Kind regards


Loanne Noirot

Recommended Posts

Hello,

The JavaScript API, which is a separate thing from the Spotfire.NET client API used by IronPython and C#, has a DataTable.getDataColumns method - https://docs.tibco.com/pub/sfire_dev/area/doc/api/TIB_sfire_Web_Player_JavaScript_API_Reference/html/M_spotfire_webPlayer_DataTable_getDataColumns.htm - which gets all data columns in a table

Link to comment
Share on other sites

About spotfire.webPlayer.DataTable. If i have several tables, how can i specify the wished table named "table1", i try something but i have undefined object or error like

"Message: applyFunc.bind is not a function

Stacktrace: TypeError: applyFunc.bind is not a function

  at spotfire.webPlayer.DataTable ".

Is it really as simple as Document.Data.Tables["table1"].Columns (IronPython)?

Link to comment
Share on other sites

Hello again!

To get a specific data table, you can use the getDataTable method (https://docs.tibco.com/pub/sfire_dev/area/doc/api/TIB_sfire_Web_Player_JavaScript_API_Reference/html/M_spotfire_webPlayer_Data_getDataTable.htm)

Here's an example where I first get a data table named "SalesAndMarketing" and then the "Store Name" data column from that.  

doc.data.getDataTable("SalesAndMarketing", function(dataTable) { console.log("This is the data table: " + dataTable.dataTableName); dataTable.getDataColumn("Store Name", function(dataColumn) { console.log("This is the data column: " + dataColumn.dataColumnName ); }); });

                 

For learning more - seeing concrete examples - about how to use the JavaScript API, I recommend taking a look at the "Test Utility Example for the TIBCO Spotfire® JavaScript API" page:

https://community.spotfire.com/s/article/test-utility-example-tibco-spotfire-javascript-api?t=1683646587699

Link to comment
Share on other sites

Thanks Fredrik,

 ```{js}

var serverUrl = "https://spotfire-next.cloud.tibco.com/spotfire/wp/";

var analysisPath = "/Samples/Expense Analyzer Dashboard";

var customizationInfo = new spotfire.webPlayer.Customization();

var app = new spotfire.webPlayer.Application(serverUrl,

  customizationInfo,

  analysisPath);

var doc=app.openDocument("container3");

doc.data.getDataTable("SalesAndMarketing",

      function(dataTable)

      {

return dataTable.dataTableName;

});

document.getElementById("container3").innerHTML = doc.data.getDataTable("SalesAndMarketing");

 ```

that was a try, but i don't have succes.

my initial purpose is : retrieve the data of my table, not data from a spotfire cloud, i want manipulate, reorganize the value on my column, just like iron python. I try to pass value from iron python but this is million of row, it's just delusional.

Link to comment
Share on other sites

Hello!

For my quick test of this, I simply used the Getting Started example from the TIBCO Spotfire® JavaScript API Overview page: 

https://community.spotfire.com/s/article/TIBCO-Spotfire-JavaScript-API-Overview#gettingstarted - I strongly recommend that you look at that for a starting point.

  

In summary:

1. Create the application (spotfire.webPlayer.createApplication)

2. In the onReadyCallback, if successful, you get the application object

3. Open the document (app.openDocument())

(Yes, doc is the document)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...