KirkD-CO
KirkD-CO

Reputation: 1793

Using Spotfire TERR from C# API

I'm working with Spotfire Analyst 14.0 in C#. I would like to interface with the TERR engine from C# to run R scripts, however, I can find zero documentation or examples of this. The most I have found thus far is DataFunctionExpressionFunction.CreateTERRExpressionFunction() and DataFunctionExpressionFunction.CreateTERRAggregation() but these don't seem the right type of item. I'm not interested in creating an Expression Function and I'm not interested in an aggregation. I would like to be able to run an R script with TERR and collect the results to create either an additional calculated column or a new table of results. Also, I have all the code to create new columns and new tables to add to the table or document, but I cannot find any documentation on how to use TERR from C#.

Any tips regarding how to interface with TERR from C# would be greatly appreciated.

Upvotes: 0

Views: 42

Answers (1)

Gaia Paolini
Gaia Paolini

Reputation: 1462

I have never called a data function from C# but I have done it with Iron Python.

The DataFunction class should help. Please look it up in the Spotfire API reference.

The simplest call (from IronPython, you need to work out the equivalent in C#) would be:

from Spotfire.Dxp.Data.DataFunctions import DataFunctionExecutorService, 
DataFunctionInvocation, DataFunctionInvocationBuilder
dataFunction = None
for function in Document.Data.DataFunctions:
    if function.Name == 'myfunctionname':
        dataFunction = function
        dataFunction.Execute()

Upvotes: 0

Related Questions