Dev Space

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

HTML SDK Macro Radio Button Problem

JosephSerpis
17 - Castor
17 - Castor

Hi I am trying to create a tool using the HTML SDK to work with a macro I have developed. The HTML interface for the radio buttons doesn't seem pass the value to the macro and then doesn't disable tool containers via the radio buttons. Below is sample of my code. Code.JPG

 

I've also attached my folder with the macro and relevant code. 

 

Any thoughts would be appreciated? 

2 REPLIES 2
chrisha
11 - Bolide

Hi JS,

 

not sure if this is the ultimate reason, but you are declaring a DataItem already in the HTML part:

 

<ayx data-ui-props='{...}' data-item-props='{dataType: "FieldSelector"}'></ayx>

 

Look at the data-item-props attribute. In your JavaScript you associate another DataItem with the widget. You should decide whether you do it through the widget in the HTML or later through the JavaScript part.

 

Furthermore: In the HTML your DataItem is a Field Selector, which allows you to select a field from the incoming connection. In the JavaScript function you create a StringSelector, which allows you to define your own set of options for the RadioGroup. Likely, the two options confuse Alteryx and you should stick with one option.

 

Hope that helps! Best

Christopher

PaulN
Alteryx Alumni (Retired)

Hey @JosephSerpis,

 

Thank you for posting on Dev Space!

 

Currently, your issue is caused by macro not retrieving the value from the HTML GUI because none of the interface tools refers to RadioGroupStringSelector.

 

This is your macro at the moment:

 

macro_original.png

 

 

Instead, you could replace the 2 Check Box tools by a single Drop Down tool, named RadioGroupStringSelector

 

macro_dropdown_configuration0.png

 

and configured with the values of the radio buttons (Option1, Option2)

 

macro_dropdown_configuration.png

 

Then connect it to a Condition tool, with formula '[#1] == "Option1"'

 

Finally, disable the two containers:

 

macro_new.png

 

 

 

That should do the trick!

 

Best,

 

Paul Noirel

Sr Customer Support Engineer, Alteryx