

Then, enter an equal sign followed by “0.0%â€. Simply choose “FormatString†in the menu, or write the first few letters and hit Tab. Tabular Editor will then generate the following code, which represents this particular measure in the Tabular Object Model: Īdding an extra dot (.) after the right-most bracket, should make the autocomplete menu pop up, showing you which properties and methods exist on this particular measure. If you locate the measure in the explorer tree, you can simply drag it onto the script editor. Say you want to change the Format String of your measure in the 'FactInternetSales' table. But as an example, let us see how we could achieve the same thing through scripting. If you want to change a property of one object in particular, obviously the easiest way to do so would be directly through the UI. Users unfamiliar with C# and LINQ should still be able to follow the examples given below. It is assumed that the reader is already somewhat familiar with C# and LINQ, as these aspects of Tabular Editors scripting capabilities will not be covered here. Furthermore, the wrapper provides convenient methods that turn many common tasks into simple one-liners. Simply press CTRL+Z after executing a script, and you will see that all changes made by the script are immediately undone.


The main advantage of working through this wrapper is, that all changes will be undoable from the Tabular Editor UI. Please see Scripting API for a complete listing of objects, properties and methods in the Tabular Editor wrapper library. which all have corresponding wrapper objects. The same applies to any descendant objects, such as Table, Measure, Column, etc. The Model object is a wrapper of the class, exposing a subset of it’s properties, with some additional methods and properties for easier operations on translations, perspectives and object collections. The former contains methods and properties that allow you to manipulate all objects in the Tabular Model, whereas the latter exposes only objects that are currently selected in the explorer tree. The scripting API provides access to two top-level objects, Model and Selected. For this reason, Tabular Editor introduces Advanced Scripting, which lets advanced users write a script using C# syntax, to more directly manipulate the objects in the loaded Tabular Model. There may be many other common workflow tasks, which are not as easily performed through the UI however. The right-click context menu of the explorer tree provides a convenient way to perform many of these tasks, such as adding/removing objects from perspectives, renaming multiple objects, etc. For example, changing the Display Folder of multiple measures at once is just a matter of selecting the objects in the explorer tree and then dragging and dropping them around. The goal of the UI of Tabular Editor is to make it easy to perform most tasks commonly needed when building Tabular Models. Also, make sure to check out our script library C# Script Library, for some more real-life examples of what you can do with the scripting capabilities of Tabular Editor. Information in this document is subject to change. This is an introduction to the Advanced Scripting capabilities of Tabular Editor.
