ALTERYX INSPIRE | Join us this May for for a multi-day virtual analytics + data science experience like no other! Register Now

Dev Space

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

ListRunner Bug with HTML Interface Tools

bobpeers
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.

<Configuration>
  <user>SF_TEST@ALTERYX.DK</user>
  <okta_url>https://inviso.okta.com</okta_url>
  <account>ACCOUNT.eu-west-1</account>
  <warehouse>WH</warehouse>
  <database>DEMO_DB</database>
  <schema>public</schema>
  <temp_dir>C:\Users\me\Desktop</temp_dir>
  <table>dev</table>
  <case_sensitive>False</case_sensitive>
  <key>
  </key>
  <sql_type>create</sql_type>
  <auth_type>okta</auth_type>
  <password>201000000xxx</password>
</Configuration>

 

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.

 

<key>
  </key>

 

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