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:
- Locate the information link by searching for one with the value of the known property.
- List the prompts and get the column identifier.
- List the named parameters and get the parameter name.
- 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 =
InformationLinkDataSource.FindAll("myown.marker::parameterized");
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 =
InformationLinkParameter.CreateNamedParameter(
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
application.Open(datasource);
}