private void ExecuteDataFunction(TestToolSettings testToolSettings) { testToolSettings.Document.Transactions.ExecuteTransaction(delegate { InputParameter categoryColumns, dataColumns, calculateKind; OutputParameter returnMessage, resultAll; bool includeFilter = string.Equals("filtered", settings.DataRange, StringComparison.OrdinalIgnoreCase); DataFunction function = testToolSettings.Document.Data.DataFunctions.AddNew("RTest", GetFunctionDefinition(out categoryColumns, out dataColumns, out calculateKind, out returnMessage, out resultAll)); string categoryColumnsExp = string.Join(",", settings.CategoryColumns.Select(c => $"[{settings.DataTable}].[{c}]").ToArray()); function.Inputs.SetInput(categoryColumns, categoryColumnsExp, includeFilter); string dataColumnsExp = string.Join(",", settings.DataColumns.Select(c => $"[{settings.DataTable}].[{c}]").ToArray()); function.Inputs.SetInput(dataColumns, dataColumnsExp, includeFilter); function.Inputs.SetInput(calculateKind, $@"""{settings.CalculatedKind}"""); function.Outputs.SetTableOutput(returnMessage, "returnMessage"); function.Outputs.SetTableOutput(resultAll, "resultAll"); function.Execute(); }); }