community
cancel
Showing results for 
Search instead for 
Did you mean: 

Dev Space

Customize & extend the power of Alteryx. SDKs, APIs, custom tools, and more!
Community v19.6

Looks aren't everything... But the latest Community refresh looks darn good!

Learn More

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

Asteroid

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