Skip to main content

Using ATL View

ATL View is available in all project types and is the default for "Describe a JSON Object" projects.

To switch to ATL View, click the ATL View icon in the script editor ribbon.

atlView_selectAtlView.png

Index

Why use ATL View?

ATL View does not use color markup to highlight and simplify key ATL elements such as variables, functions, and conditionals. Instead, it displays the full ATL for these elements. This makes it easier to see syntax errors (many are rendered invisible by color markup) and allows you to make changes directly to the ATL without invoking the Function Builder or Conditional Builder.

Here's a script in Marked Up View:

atlView_scriptMarkedUpView.png

And here's an example of using ATL View to edit ATL directly:

atlView_editConditional.gif

You could make this change in the Conditional Builder, but directly editing the ATL is quicker if you're familiar with the syntax.

The same applies when editing calls to ATL functions, especially when you've nested multiple functions to form a single ATL block. Directly editing the ATL is often quicker and easier than making changes in the Function Builder. Studio also has some Advanced functions that are unsupported in the Function Builder. You must work in ATL View to edit calls to these functions.

Bracket matching (ATL View)

ATL View includes a syntax-highlighting feature to help you with bracket matching. This helps you by instantly identifying syntax errors resulting from mismatched brackets. Three bracket types are used in ATL:

Type

Syntax

Double square brackets

[[ ]]

Round brackets

( )

Curly brackets

{ }

Many ATL syntax errors are caused by brackets not being opened or closed correctly, especially with multiple nested functions:

atlView_missingBracket.png

This ATL block uses a nested combination of functions to (1) sum-total a list of numbers from the Sales variable, (2) apply currency formatting to the summed total, and (3) abbreviate the currency expression. The ATL will produce an error because it's missing a closing round bracket.

The color markup for bracket matching reduces the risk of this type of error because it marks up bracket-matching syntax errors as you type. Notice how red markup indicates when a bracket has been opened but not closed:

atlView_bracketMatching1.gif

You can also use the color markup to investigate errors in an already completed ATL block. Below, for example, is the ATL for a simple conditional. It uses all three types of brackets — double square, round, and curly — but there are multiple syntax errors.

atlView_multipleErrors.png

To find the bracket-matching errors, place the cursor next to a bracket. Red markup indicates that there is a problem. Green markup indicates that the brackets are matched correctly:

atlView_fixingTheConditional.gif

Important

Be aware that this feature highlights bracket-matching errors only — it does not highlight other syntax errors such as using the wrong bracket type.

Find and replace (ATL View)

To open the Find and Replace tool, click the Find icon. This is available in ATL View only.

atlView_findIcon.png

You can also open the tool using the Ctrl + f keyboard shortcut.

Tip

A similar Find and Replace tool is available in Code View. We recommend using that when searching for the elements that you can't see in ATL View (e.g. HTML tags).

Enter your search term in the Find field and hit Enter on your keyboard.

atlView_caseInsenstiveFind.gif

The search is case-insensitive by default. This is why the search for "Sales" (see above) finds the fixed text "sales" along with each reference to Sales (a UDF). You can make the search case-sensitive by clicking the Case Sensitive checkbox:

atlview_caseSensitiveFind.gif

Tip

You can click the Case Sensitive box before or after entering your search term.

The tool is useful when you have renamed an ATL element — e.g. a variable or user-defined function (UDF) — and you want to instantly update all references to that element in your script. The example below finds all references to the Sales UDF and replaces them with Total.

atlView_findReplace.gif

Tip

As shown above, click the arrow to the left of Find to expose the Replace bar.

Regex search

A regular expression (regex) is a sequence of characters expressing a pattern to search for within a larger piece of text. This is useful when you need to find content that matches a format pattern rather than a specific string.

Suppose you want to find plural nouns in your script's fixed text (any text that does not form an ATL element). You might want to do this so you can judge which nouns you should turn into countable expressions using the countable function.

You could search for "s" (as many plural nouns end in "s"), but this would find every instance of "s" in your script. You want strings that end in "s" and are followed by a whitespace character. You can use the regex \w+s\s to search for this content:

atlView_regexFind.gif

Tip

For help with regular expressions, see https://www.regular-expressions.info/quickstart.html.

Ctrl + click to open scripts

Uniquely in ATL View, you can open a script by holding the Ctrl key ( on a Mac) and clicking on any call to that script in your code. As usual, the opened script is highlighted in the scripts panel.

atlView_ctrlClick1_740.gif

A no-entry icon appears when you Ctrl-click on anything that isn't a script name.

atlView_ctrlClick2_740.gif

formatDateTime and parseDateTime are the names of in-built ATL functions, not scripts.