Alteryx IO Discussions

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

Macro as Plugin

bkclaw113
9 - Comet

Can an Alteryx Plugin be created with the platform SDK (React frontend) when a macro is used as the backend or can plugins only be created with Python  (or other code based) backend?

3 REPLIES 3
JarrodT
Alteryx
Alteryx

Hey, @bkclaw113!

 

Yes, this is possible with some react-comms and config.xml file modifications. This is how the new Server API Tool was created. 

 

After setting up your workspace through the cli and creating your plugin*

*Make sure you use the option below when creating the plugin if on ayx-plugin-cli v1.1"

--use-ui

 

Then unzip the attached template files into the following folder: 

ui\{ToolName}\node_modules\@alteryx\react-comms

 The template.zip folder contains 3 files that need to go into their respective sub folders:

\DesignerApi\index.js
\DesignerMessageApi\index.js
\Utils\callback.js

 

This is what translates the json model used on the frontend to the XML structure ingested by the tool in designer.

 

Then the EngineDll values need to be updated in the config.xml file found here:

configuration\{ToolName}\{ToolName_version}Config.xml

so it looks like this:

<EngineSettings EngineDll="Macro" EngineDllEntryPoint="{ToolFolder}\{subdirectory(as needed)}\{Macro_Name}.yxmc" SDKVersion="10.1"/>

 

Then build the yxi (or install), using the --use-ui option again. This will put a yxi file into the build\yxi folder. 

Extract the yxi and you'll see a sub folder with your macro name in it (this is the folder that gets copied into the appdata\roaming\alteryx\tools folder when you run the yxi installer.) 

JarrodT_0-1686766748571.png

enter that folder:

JarrodT_1-1686766840440.png

You will see a .pyz file here - delete that file since we won't be using python as the backend and it can be quite large.

 

Here is where I insert my macro (and any supporting files) so that it matches the file path I defined in the config.xml file above. 

Note - Because this folder is re-written each time you build the yxi, it is best to have this Supporting_Macros folder saved in a separate location and just copy it in when you rebuild the yxi from the command line. 

 

Navigate up one directory and send the files into a .zip folder:

JarrodT_2-1686767084186.png

 

Rename the extension from .zip to .yxi.

Then you can then install it and/or distribute it as needed. 

 

Hope this helps!

- Jarrod

JarrodT
Alteryx
Alteryx

One point I want to add is that in order to access the values from the front end model, the macro interface tools names need to match your model. So if your Configuration looks like this in React:

 

{ 
  Configuration: {
    checkBox1:"false", 
    nameOfPet:"Rover", 
    authToken:"28fhox82jd82"
  }
}

 

Then you'll need to rename the interface tools "checkBox1", "nameOfPet", and "authToken" in the annotation section of the configuration window within your macro. I use all Text input interface tools regardless of data type.

JarrodT_0-1686771269215.png

 

bkclaw113
9 - Comet

Thank you for the detailed response, I have not had the opportunity to dig in and walk through all of the information that you provided but once I confirm it works as expected I will be sure to come back and Accept the Solution.