Dev Space

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

How to parse multiple fields for using in custom code for Alteryx Python SDK custom tool

amitupadhyay
8 - Asteroid

Hello community members,

 

I seek you help for building a custom tool in Alteryx using the Alteryx Python SDK functionality. In my GUI HTML file I have 2 drop down menus to select 2 different fields from a single input. I will be using both these fields to perform an operation in the ii_push_record method in the Incoming Interface class of my python code. 

 

I declared two dropdown interface tools in GUI HTML file in the following way:

<div>

<label>XMSG("Select Field1")</label>

<ayx data-ui-props="{type: 'DropDown'}" data-item-props ="{dataName: 'FieldSelect',dataType: 'FieldSelector',anchorIndex:'0',connectionIndex:'0'}"></ayx>

<\div>

<div>

<label>XMSG("Select Field2")</label>

<ayx data-ui-props="{type: 'DropDown'}" data-item-props ="{dataName: 'FieldSelect',dataType: 'FieldSelector',anchorIndex:'0',connectionIndex:'0'}"></ayx>

<\div>

 

How do I call these 2 fields in the ii_push_records method? The default method is to copy the incoming records as "in_record", but how do I separate both the fields I need?

Default Python code in ii_push_records method:

def ii_push_record(self, in_record: object) -> bool:

# Copy the data from the incoming record into the outgoing record.
self.record_creator.reset()
self.record_copier.copy(self.record_creator, in_record)

if self.parent.input_field.get_as_string(in_record) is not None:
field1 = self.parent.input_field.get_as_string(in_record)

How do I parse field2?

 

0 REPLIES 0