我想在TIBCO Spotfire的IronPython / Python脚本中包含以下代码。有人对此有解决方案吗?我是IronPython / Python和Spotfire的初学者。提前非常感谢!
关于费利克斯
{
var table = application.Document.Data.Tables.DefaultTableReference;
var sourceView = table.GenerateSourceView();
Func<StringBuilder, DataOperation, string, int> dumpOperationInfoRecursively = null;
dumpOperationInfoRecursively = (stringBuilder, operation, indentationSpaces) =>
{
int step = 1;
// If the operation had any inputs, then first print the first input's information.
if (operation.Inputs.Count > 0)
{
step = dumpOperationInfoRecursively(stringBuilder, operation.Inputs[0], indentationSpaces);
step++;
}
// Print information about this operation.
stringBuilder.AppendFormat("{0}{1}. {2}\r\n", indentationSpaces, step, operation.DisplayName);
// Output names of any transformations we have.
IList<DataTransformation> transformations = new List<DataTransformation>();
var ost = sourceView.OperationsSupportingTransformations.FirstOrDefault(op => op.DataOperation == operation);
if (ost != null)
{
transformations = ost.GetTransformations();
}
int index = 0;
foreach (var transformation in transformations)
{
stringBuilder.AppendFormat("{0}{1}. {2}\r\n", indentationSpaces + " ", Convert.ToChar('a' + index), transformation.Name);
index++;
}
// Last, print information about additional inputs. (Typically the
// additional data for an Add Rows or Add Columns operation.)
for (int i = 1; i < operation.Inputs.Count; ++i)
{
dumpOperationInfoRecursively(stringBuilder, operation.Inputs[i], indentationSpaces + " ");
}
// Returns the step number for this operation.
return step;
};
var sb = new StringBuilder();
dumpOperationInfoRecursively(sb, sourceView.LastOperation, string.Empty);
return sb.ToString();
}
正如Oliver所说,这不是python,因此您不能将其导入Spotfire中的IronPython。如果要获得相同的结果,则需要编写具有相同功能的python脚本。就是说,这看起来好像您正在尝试重写Concatenate()函数,尽管还不是很清楚,而且我不确定您打算将什么用作输入或打算将输出放在何处。您要导入什么来完成什么?正如我提到的那样,答案似乎是“ use Concatentate()”,但我认为如果这不是您想要的内容,我们需要更多信息。