Dev Space

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

HTML GUI SDK: Show options only if incoming connection is present

chrisha
11 - Bolide

Hey dev community,

 

I'm currently working on a tool using the Python and HTML GUI SDK. The tool has an optional input. And depending on whether there is an incoming connection or not, I want the tool UI to show additional settings. To achieve this, I have the following in my Gui.html:

 

 

Alteryx.Gui.BeforeLoad = (manager, AlteryxDataItems, json) => {
    // Display incoming settings only if there is data incoming
    var hasIncomingStream = manager.getIncomingFields().length > 0
    window.document.getElementById("incoming-settings").hidden = !hasIncomingStream
    manager.getDataItem("IncomingField").setDisabled(!hasIncomingStream)
}

 

 

It works well and as intended: When I connect an incoming stream, the element with #incoming-settings is shown and hidden otherwise.

 

There is one instance, though, when the above does not work: When having an incoming connection present (see screenshot), but just having loaded the workflow. In this case, metadata is not yet available and the GUI does not show the #incoming-settings:

Screenshot 2019-08-02 at 10.58.06.png

When I run

 

window.Alteryx.Gui.Manager.getIncomingFields()

 

in Devtools, I see that the Array has one item, but it seems not to be present when BeforeLoad(...) is called:

Screenshot 2019-08-02 at 11.00.18.png

 

 Is this a known bug? Or is there a more reliable way to check for the presence of an incoming connection?

 

Best

Christopher

 

1 REPLY 1
John_Rutter
6 - Meteoroid

I have a similar use-case, where I want to display parts of the UI when there are incoming connections, but when there are not, they are not needed.  I can neither find something that can accurately determine whether there are incoming connections nor can I find one to determine if the config routines have been run.