Scripting Made Easy with ThoughtSpot Modeling Language

Data

Scripting Made Easy with ThoughtSpot Modeling Language

If you’ve heard about ThoughtSpot, you are probably as excited as we are here at Interworks about its potential. If you are not too familiar with this tool I’d strongly suggest this article series.

Several of our clients in Sydney and Melbourne all agree on one aspect of the delivery of BI solutions: the development of dashboards has traditionally been slow, meaning that by the time the artifact is completed, the business requirements have already changed. And here is where the disruptiveness of ThoughtSpot comes in. Not only because of the speed of delivery it allows, but also because it puts new options on the table. One of them, and the subject of this article, is what’s called ThoughtSpot Modeling Language (TML).

In short, TML is a scripting approach that allows you to update and manipulate a whole bunch of things within ThoughtSpot: worksheets, views and Liveboards, among others. The word scripting may sound daunting but fear not: one of the principles of TML is to be human-readable. Let’s try it out.

Setting the Scene

To make sure you make the most of the subject we’ll cover today:

  1. You will need a foundational understanding of ThoughtSpot. If you’ve built a couple of basic Liveboards in the past, you will be just fine.
  2. You will require editing permissions on one Liveboard. You can read more about privileges here. Alternatively, your ThoughtSpot admin should be able to help you.

In this article, I will show you how to handle a scenario I stumbled across recently with one of my clients in Singapore: the need to make bulk changes in a dashboard. Note that I am using ThoughtSpot Cloud 8.9.0.

Imagine that with the new year, a situation had become apparent in one of your Liveboards — there were references to 2022 in the title of every single answer:

A liveboard with "2022" in every field

Granted, we could modify all these references by individually editing each answer. That would be relatively straightforward, but we’d need to do it for every answer. What if we could make all the changes in one go? Here is where the power of TML kicks in.

Using TML with a Liveboard

Open the Liveboard you want to edit. On the top-right, you will find an icon with three dots (in orange below) which presents two options. We can either:

a) Download a TML file, edit it locally in our machine with a basic text editor (think Notepad style) and then re-upload it (in red below).

or

b) Update the TML straight from the web interface (in blue below). In this article I will show you the latter.

Showing options on using TML with a liveboard

So, let’s click on the “Edit TML” option. This will effectively prompt the screen below. And there you have it in all its glory — your Liveboard expressed in TML in a flat-file format:

Edit TML option for the Liveboard

A couple of things before getting into the weeds: First, this file contains details and configuration about your Liveboard. In a way you are reading your Liveboard. Making changes here is equivalent to editing your Liveboard with the regular interface. Second, ThoughtSpot uses some keywords (the text in green) called TML parameters. These help describe the objects and its features. Don’t edit them.

On the left-hand side, you may notice a list of numbers: these simply represent the row lines so it’s easier for you to navigate this document. In line 6 of my example (above), you’ll read “Viz_1” and underneath (and indented), you will find the configuration of that visualization. For example, in line 8, next to “name” you’ll find the title of the viz (in blue text). I will remove the reference to 2022 from it:

Removing 2022 from the liveboards

Next I will press ctrl+f (or cmd+f if you use Mac) to search all the references to 2022 so I can easily remove all the references:

Searching for references to the year in a liveboard

Now I can just save and commit those changes. First click “Validate” on the top right to check that all the changes that you made are correct. Then click “Publish”:

Validating Liveboard changes

Showing a successful save on a Liveboard

Now, if I head to the Liveboard and refresh it, you’ll notice how all references to 2022 are gone:

View of liveboard missing 2022

Well done!

Whilst we are at it, perhaps we could also adjust the size of the answers in our Liveboard. We can also do that from the standard interface by first clicking on “Edit”:

Showing edit button on Liveboard

Then on the three dots for every single answer:

Showing the edit screen on Liveboard

Again, with TML we can just make those changes in one go. Back in our TML editor head to the bottom of the text file. By default, and if you have not made any changes to the layout beforehand, you will see something like the below. Simply replace the word MEDIUM by SMALL: 

Showing Tile Layout in a Liveboard

Then Validate and publish and the layout will be updated. Sure enough, the size of the tiles has been adjusted. As you see, with TML you can make bulk changes to your Liveboards in a much more efficient way. But the power of this feature is not limited to that. You can find additional uses cases and functionally in ThoughtSpot’s official documentation on TML.  Alternatively, give us a shout if you need help making the most of out of your ThoughtSpot implementation.

More About the Author

Roger Garcia

Solutions Engineer
Exploring Tableau Pulse To Replace Traditional Dashboards In the business intelligence space, the main medium used up until very recently to interact with data was that of a compilation of data ...
Recreating Level of Detail Calculations in Power BI While visualizations provide a valuable snapshot of data, they often fall short in accommodating the diverse analytical needs of ...

See more from this author →

InterWorks uses cookies to allow us to better understand how the site is used. By continuing to use this site, you consent to this policy. Review Policy OK

×

Interworks GmbH
Ratinger Straße 9
40213 Düsseldorf
Germany
Geschäftsführer: Mel Stephenson

Kontaktaufnahme: markus@interworks.eu
Telefon: +49 (0)211 5408 5301

Amtsgericht Düsseldorf HRB 79752
UstldNr: DE 313 353 072

×

Love our blog? You should see our emails. Sign up for our newsletter!