Alteryx Designer Desktop Knowledge Base

Definitive answers from Designer Desktop experts.

Tree Processing Macro

Alteryx_KB
Alteryx
Alteryx
Created

Business Problem:


When creating custom Tree questions in Alteryx, the Module or Macro designer will typically use the “Custom File/Database” mode of the tool. This is a great option because of the ease with which the data can be arranged to populate a great Tree question. Handling the Action side of a Tree question can sometimes be a little challenging, and the goal of this macro is to streamline that process.

 

Overview:


Consider for a moment the following example where the user has selected “Blue Whale” from the Tree. Would you like just the record for “Blue Whale”, or would you like the parent records from that selection? Depending on your choice in the Tree Processing Macro, you can receive the following outputs from the tool.

 

What if we had selected “Whales”, how would you like to handle the child records from that selection? The Tree Processing Macro makes it is easy, as it will return all of child records for you automatically.

 

The macro is designed to reside in the .yxwz from which the user will interact with the Tree Question. The same file that is referenced in the Tree Question should also be present as an Input tool. This Input tool will populate the connection to the “D” (Data) input of the Tree Action Macro. The “T” (Tree) connection will be populated by a connection from a Text Input tool. As every Question has an accompanying Action, your .yxwz's Action will update the Text Input tool.2019-04-22_13-33-36.png

 

 

2019-04-22_13-35-28.png

 

 


The Tree Action Macro has two configuration settings; the first defines whether you wish to exclude branches as records in the output. The second setting allows you to define the key length. Apart from these settings, the Tree Action Macro will take care of the rest.

2019-04-22_13-36-07.png

 

2019-04-22_13-36-23.png


I have provided a sample Analytic App that details the use of the Tree Action Macro, and the difference between including branches as records and excluding them.

Attachments