Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Dev Space

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

Connection with bAllowMultiple=true

360Andy
7 - Meteor

I want my custom component to have one input connector that can have multiple upstream components connected - like the Union tool.

I'm guessing that I do this by passing true for the bAllowMultiple parameter when I create a new Connection in IPlugin.GetInputConnections()

 

So, I tried this, but then in GetConfigurationControl() instead of the eIncomingMetaInfo being like:

<MetaInfo connection="Output">
    <RecordInfo>
        <Field name="customer_id" size="254" ...  type="V_String" />
        <Field name="first_name" size="254" ... type="V_String" />
        <Field name="last_name" size="254" ... type="V_String" />
        ...
   </RecordInfo>
</MetaInfo>

I just get:

<MultiMetaInfo>
    <MetaInfo name="#1" />
</MultiMetaInfo>

So, how do I get the RecordInfo? Shouldn't the MetaInfo node contain a RecordInfo node?

8 REPLIES 8
360Andy
7 - Meteor

@TashaA is there some documentation on this kind of thing somewhere? The documentation I have doesn't cover this.

TashaA
Alteryx Alumni (Retired)

Adding @BlytheE, our new Product Manager of Developer Tools!

MichaelCh
Alteryx
Alteryx

Are you using the Python SDK, the C# SDK, or the C++ SDK?

 

When you write your ToolNameConfig.xml are you setting AllowMultiple to true there? i.e.

    <InputConnections>
      <Connection Name="Input" AllowMultiple="True" Optional="False" Type="Connection" Label="I"/>
    </InputConnections>

There's an example Python SDK tool that does this that may help you. You can find it here:

https://help.alteryx.com/developer/current/Python/Examples.htm?tocpath=SDKs%7CBuild%20Custom%20Tools...

 

Note that there is a defect on that page as of this posting--the single anchor multiple input download link points to a different example tool. That should be fixed for posterity, but for now you can download the relevant tool here.

360Andy
7 - Meteor

Hi Michael, thanks for the response.

 

I'm using C# for the UI and C++ for the engine.

 

So, I'm specifying true for AllowMultiple like this:

 

 

public Connection[] GetInputConnections()
{
	return new Connection[]
                { new Connection("Pairs", null, true, false, 'P') };
}

 

That seems to be working because after changing this to true I get <MultiMetaInfo> passed to GetConfigurationControl() rather than <MetaInfo>.

My problem is that the <MultiMetaInfo> doesn't contain any <RecordInfo>s.

 

 

 

360Andy
7 - Meteor

Hey @MichaelCh, any idea how I get the <RecordInfo> with multiple inputs?

MichaelCh
Alteryx
Alteryx

I'm not familiar with the C# SDK; it sounds like it operates differently from the C++ and Python SDKs?

 

What I would expect with the other SDKs is that for multiple inputs on my PI plugin, PI_AddIncomingConnection would be called once for each input. That method would have to return an II plugin. Then for each input, the II plugin would be called with II_Init containing the RecordInfo for that input.

360Andy
7 - Meteor

I'm using C++ for the engine and that is where the Plugin Interface methods, like PI_AddIncomingConnection(), are implemented.

 

I'm only using C# for the UI, where it implements the IPluginConfiguration interface methods: GetConfigurationControl() & SaveResultsToXml().

 

Using C++ for the engine and C# for the UI is how the SDK sample code that I copied works.

 

It is the IPluginConfiguration interface I'm having a problem with, not the Plugin Interface.

 

The method GetConfigurationControl() is like:

 

public Control GetConfigurationControl(AlteryxGuiToolkit.Document.Properties docProperties,
            XmlElement eConfig,
            XmlElement[] eIncomingMetaInfo,
            int nToolId,
            string strToolName)

The comment from the sample code is:

 

// This method is called by Alteryx to initialize this configuration control from data
// stored in the module containing this tool.

// Tool configuration is handled through an XML document managed by Alteryx. When it is
// time to initialize this control (generally when it is made visible to the user), this
// method is called, passing the XML document in with the eConfig parameter.

// When this tool is connected to one or more upstream data providers, the structure of
// each data stream is passed as an entry in the eIncomingMetaInfo array. This data can
// then be used to dynamically construct your UI based on the type of input.

 

The key thing being "the structure of each data stream is passed as an entry in the eIncomingMetaInfo array".

But when AllowMultiple is true, the eIncomingMetaInfo array does not contain the structure of the upstream data.

MichaelCh
Alteryx
Alteryx

I know nothing about the C# UI SDK unfortunately.

 

Is there a reason to continue to use it rather than the HTML UI SDK?