Using TRACE statements

Contents[Hide]

1. Overview

This article shows you how to use #TRACE statements in server-side scripts such as the ones used in data cube transforms. The output from #TRACE statements goes to the Admin Log which can help you to debug your scripts.

Server-side scripting is used in the following areas of the application:

  • Data connectors (OLAP)
  • Tokens
  • Formulas
  • Transforms (e.g., Calculated Element)
  • Bridge Parameters

2. Using #TRACE with a Calculated Element transform

For this example, create a new data cube and drag the [Production].[Product] table from a data connector in Explore to the canvas.

Create a new data cube
Create a new data cube

Select the connection link between the two transforms, go to the toolbar, click Insert Common, and then click Calculated Element.

Double-click the Calculated Element transform to configure it. In the configuration dialog, scroll down and click the plus button under Calculated Elements to add a new calculated element (i.e., a new output column which will be defined using a script).

Enter the Name of the calculated element, set its Data Type to String, and then type in the following Expression (script).

if ( $Color$ == "Silver" )
{
    #TRACE "Product: ", $Name$;
}
return $Name$ + " " + $Color$;

This script creates a new output column by concatenating two existing string columns. It also outputs a #TRACE statement to the Admin Log for each product that has a Silver color.

Enter the script for the calculated element transform
Enter the script for the calculated element transform

Select the Process Result transform on the canvas and then click Data Preview to see the output from the data cube.

Data Preview for the data cube
Data Preview for the data cube

Finally, if you're an administrator, go to the Admin Log screen to see the output of the #TRACE statements that ran when the data cube was previewed. You'll see some information about the data cube that executed, the line number of the #TRACE statement in the script (helpful if you have multiple such statements), and the actual output of the #TRACE statement itself (i.e., listing the product name).

View the #TRACE output from the Admin Log
View the #TRACE output from the Admin Log

3. See also

Dundas Data Visualization, Inc.
500-250 Ferrand Drive
Toronto, ON, Canada
M3C 3G8

North America: 1.800.463.1492
International: 1.416.467.5100

Dundas Support Hours: 7am-6pm, ET, Mon-Fri