You can create a data function that uses the
Spotfire
debugging flag to check if data function debugging is enabled, and then use a
Spotfire
control to report the status of the debugging option.
About this task
Being able to
determine quickly if you have set the debugging option for your data functions
is a useful developing technique. Perform this task in
Spotfire Analyst.
Before you begin
- You must have the Advanced
Analytics license in
Spotfire Analyst
to use the data function feature. If you do not see the menu item, contact the
Spotfire
administrator.
- Load a data set or an
existing visualization to use for testing the debugging flag. If you are
starting with a blank
Spotfire Analyst
session, you can use one of the data sets provided as examples. Follow the
instructions in
Importing TERR Data Sets Using a Data Function.
Procedure
-
From the
Spotfire Analyst
menu, click
.
-
Register the new data function.
-
In the
Name text box, provide a meaningful name,
such as
DebugFlagTest.
-
Clear the check box
Allow caching.
You must ensure there is no caching so that the data function
checks the option each time you send a request.
-
In the
Script tab, write the following script.
#create an object to check if the data function debuging option is set.
debug <- getOption("debug.spotfireConnector", FALSE)
#create an object to hold the output text reporting if the option is set.
x<- "Debugging is not enabled."
if (debug) x <- "Debugging is enabled."
For more information about the
getOption
function, see the
TERR Language Reference.
-
Click the
Output Parameters tab, and then click
Add to specify the output parameter.
-
For the
Result parameter name, specify
x, and for the
Type, select
Value.
-
Click
OK, and then click
Run.
The
Edit Parameters dialog box is displayed.
-
Clear the
Refresh function automatically check box,
and then select the
Output tab.
-
In the
Output parameters list box, select the
x
output parameter, and for
Output handler, select
Document property.
-
Click
New, and in the
New Property dialog box, for
Name, type
DebugFlag.
-
Click
OK, and then close the
Register Data Functions dialog box.
You are prompted to save the data function to the
library.
-
Click
Yes to save the data function in the
library so you can use it in all of your data-function-enabled visualizations.
-
Create a text area to provide the information returned from the
data function.
-
Add a Text Area to the visualization, and
in the
Text Area title bar, click the
Edit Text Area button.
-
Click the
Insert Property Control button, and from
the list, select
Label.
The
Property Control dialog box is displayed.
-
In the
Document Properties tab, accept the default.
The new property should be selected, and the Value should be
the value you provided in the data function.
-
Click OK to insert the label control.
-
In the
Edit Text Area window, click the
Insert Action Control button.
The
Action Control dialog box is displayed.
-
In the
Actions pane, select
Data Function.
-
Provide
Display text, such as
Refresh.
-
From the
Control type drop-down list box, select
Button.
-
From the
Available data functions list box, select
the data function you created.
-
Click
OK to accept the changes.
-
Move the button in the text area to an appropriate position in
relation to the label control, and then close the
Edit Text Area
window, saving the changes.
- Optional:
Provide a descriptive title for the text area (or remove the
title), and resize the text area to an appropriate size.
-
Test the new controls.
-
In the text box you created, click the button.
The label control text should reflect the state of the
data function debugging option.
-
From the menu, click
,
and in the
Options dialog box, scroll and select
Data Functions, and then change the state
of the
Enable Data Function debugging check box,
and save the change.
-
In the text area, click the button again. The status should
change to reflect the current state of the data function debugging option.