Dev Space

Customize and extend the power of Alteryx with SDKs, APIs, custom tools, and more.

Custom .NET tool

Hello,

  I am trying to create a custom tool so that it appears in tool palette of alteryx. I am able to successfully create one that appears but i am facing errors when i try to create some functionality to it. My goal is the tool i create should be able to concatenate two strings given to it. Following is the code i built so far. But i am not able to create an input port to pass the strings from another input file. I want this to look like a filter or formula tool we have in built. Can you please help me.

 

using AlteryxRecordInfoNet;
using OmniBus.Framework;
using OmniBus.Framework.Attributes;
using OmniBus.Framework.Interfaces;
using System.Collections.Generic;
using static AlteryxGuiToolkit.FormatSpecificOptions.FormatSpecificOptions;

namespace CreateTools
{
public class AddAnyEngine : BaseEngine<AddAnyConfig>
{
[ CharLabel('O')]

public IOutputHelper Output { get; set; }
#if DEBUG
public override bool ShowDebugMessages() => true;
#endif
public override bool PI_PushAllRecords(long nRecordLimit)
{
this.DebugMessage($"{nameof(nRecordLimit)} Called with {nameof(nRecordLimit)}={nRecordLimit}");
this.Output.Init(
FieldDescription.CreateRecordInfo(
new FieldDescription("FirstName", AlteryxRecordInfoNet.FieldType.E_FT_V_String),
new FieldDescription("LastName", AlteryxRecordInfoNet.FieldType.E_FT_V_String)));
if (nRecordLimit != 0)
{
var nodes = this.ReadNodes();
if (nodes == null)
{
return false;
}
long recordcount = 0;
foreach(var data in nodes)
{
this.Output.PushData(data);
recordcount++;
if (recordcount % 100 == 0)
{
this.Output.PushCountAndSize();
}
if (nRecordLimit == recordcount)
{
break;
}
}
}
this.Output.PushCountAndSize();
this.Output.Close(true);
return true;
}
public IEnumerable<object[]> ReadNodes()
{
yield return new object[] { "Shalini", "Polimetla" };
}
}
}

 

0 REPLIES 0