C# Script Helper Methods
Applies to:
- ✔Tabular Editor 2.x
- ✔Tabular Editor 3.x
When writing C# scripts in Tabular Editor, a number of global methods (i.e. methods that can be called without prefixing a class or object name) are available.
The full list of these can be found in the API documentation.
Below is a summary of these methods. Click on a method name to browse the API documentation for that method.
Method |
Purpose |
---|---|
CallDaxFormatter |
Format all DAX expressions on objects currently flagged for formatting. |
CollectVertiPaqAnalyzerStats |
Collects VertiPaq Analyzer statistics for the currently loaded model. |
ConvertDax |
Changes the character used for decimals and list separators in a DAX expression. |
CustomAction (+2) |
Invoke the custom action (aka. macro) with the given name. |
Error |
Displays an error message in a popup dialog. When the script is running in the CLI, an error message is written to the console. |
EvaluateDax |
Evaluates the specified DAX expression against the connected database and returns a data table or scalar value containing the result. |
ExecuteCommand |
Executes the specified TMSL or XMLA command. |
ExecuteDax |
Executes the specified DAX query. |
ExecuteReader |
Executes the specified DAX query. |
ExportProperties |
Export properties of the specified set of objects to a TSV (tab-separated) string. Use ImportProperties to import properties from a TSV string. |
FormatDax (+2) |
Flags the specified object for formatting after script execution or the next time CallDaxFormatter is called. |
GetObjectPath |
Returns a string representation that uniquely identifies the specified object within the model. |
ImportProperties |
Applies properties to objects based on a string representation (tab separated format) of property values to assign, such as obtained by ExportProperties . |
Info |
Displays an informational message in a popup dialog. When the script is running in the CLI, an information message is written to the console. |
LineBreakFirstChar |
Ensures that a DAX expression starts with a line break. |
Model |
The currently loaded Model . |
Output |
Displays detailed information about the specified object or collection of objects in a popup dialog. When executed through the UI, the user has an option to ignore additional popups. When the script is running in the CLI, the information is written to the console. |
ReadFile |
Read the specified file as text |
ResolveObjectPath |
Resolves an object within the model based on a string such as the one obtained by GetObjectPath . |
SaveFile |
Saves the specified text to a file |
SelectColumn (+1) |
Displays a dialog that allows the user to select a column from the specified list of columns. |
Selected |
An object that represents the current selection in the TOM Explorer. |
SelectMeasure (+3) |
Displays a dialog that allows the user to select a measure from the specified list of measures. |
SelectObject |
Displays a dialog that allows the user to select a model object from a list of objects. |
SelectObjects |
Displays a dialog that allows the user to select one or more model objects from a list of objects. |
SelectTable (+2) |
Displays a dialog that allows the user to select a table from the specified list of tables. |
SuspendWaitForm (+1) |
Hides the "Please wait" spinner while performing the specified action. Useful if the action displays custom dialogs / UI to the end user. |
WaitFormVisible |
Toggle the "Please wait" spinner on/off. Useful if you want to display custom dialogs / UI to the end user. |
Warning |
Displays a warning message in a popup dialog. When the script is running in the CLI, a warning message is written to the console. |