Skip to main content
RSS feed Subscribe to feed


Skip Navigation LinksHome  Extending the Spotfire Platform  Creating Extensions to the Spotfire Platform  Creating a Tool  How to Create an Information Link Tool  Locate an Information Link by Property Name and Set Prompt Values

©Spotfire 2011

Locate an Information Link by Property Name and Set Prompt Values

This example shows how to locate an information link with a single prompt, set the prompt, and set the named parameter of a column element.

Suppose an information link has had its name changed, but it is known to have a single prompt and a column element with a named parameter. The task is to set the prompt and named parameter without hard coding the identifiers.

The solution requires four actions:

  1. Locate the information link by searching for one with the value of the known property.
  2. List the prompts and get the column identifier.
  3. List the named parameters and get the parameter name.
  4. Set the values and create the data source.
/// <summary>
/// Locate an InformationLink (having one single prompt (filter) 
/// and one single named parameter) via property search.
/// Set the prompt value and the named parameter.
/// </summary>
/// <param name="application">The TIBCO Spotfire application</param>
public static void ExecutePromptedInformationLink(AnalysisApplication application)

    // Locate the InformationLink with property myown.marker set to parameterized.
    InformationLinkDescriptorCollection links = 
    InformationLinkDescriptor link1 = links.First;

    // Get information about prompts 
    // (actually only ElementId is needed, the rest is read for educational purposes).
    string filterColumnId = link1.FilterParameters[0].ElementId;
    string filterTypename = link1.FilterParameters[0].DataType;
    string filterColumnName = link1.GetReferencedElementDescriptor(filterColumnId).Name;

    // Set the prompt values.
    InformationLinkParameter filter = InformationLinkParameter.CreateFilterParameter(
        filterColumnId, "%Column% in (%Values%)", new Object[] { "SS", "CD", "LF" });

    // Get information about named parameter 
    // (actually only ParameterId is needed, datatype is read for educational purposes).
    string namedParameterName = link1.NamedParameters[0].ParameterId;
    string namedParameterTypename = link1.NamedParameters[0].DataType;

    // Set the named parameter
    InformationLinkParameter namedParameter =
        namedParameterName, new object[] { 9 });

    // To do something with the extra information read just set the document title.
    string docTitle = link1.Name + " with filter " + 
        filterColumnName + " (" + filterTypename +
        ") and named parameter " + namedParameterName + 
        " (" + namedParameterTypename + ")";

    // Create an InformationLinkDatasource with the identifier from the first found match.
    InformationLinkDataSource datasource = new InformationLinkDataSource(link1.Id,
        new InformationLinkParameter[] { filter, namedParameter }, docTitle);

    // Open in TIBCO Spotfire Application