Dev Space

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

ListRunner Bug with HTML Interface Tools

9 - Comet

I've found a strange bug in the way the ListRunner handles tools written using the HTML SDK. My tool is using the python SDK with a HTML interface. The XML for the interface looks like this when viewed in Alteryx.



You can see the key field is sometime empty which is OK. When I process this xml in the python  SDK without using a ListRunner this code works as expected. When the key is missing it returns None, otherwise the string.


root = Et.fromstring(str_xml)
self.key = root.find('key').text if 'key' in str_xml else None


However when using the ListRunner the same code returns a newline character and two spaces. It looks to me like Alteryx normally trims the XML for newline and spaces generated by the HTML but the ListRunner just takes everything raw so when there is no entry I get the newline and spaces between the start and end tag.




I workaround this by sanitising the XML inputs using this function but it would be nice is the ListRunner worked the same way as Alteryx does natively.


def sanitise_inputs(data: str):
    if data:
        data = None if data.strip() == '' else data
    return data