This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
You're working on your gazillionth Formula tool and "Jeff" from Quality Assurance sends you an email that the margin of error for your process has been restandardized. It's not 0.122 anymore but 0.121. Then the horrible reality sets in - you're going to have to go back through all of your formulas and update that one.. stupid.. little.. number.
Alteryx can use the Run Command Tool to run Powershell scripts and perform any Powershell specific commands. Note that in order to run PowerShell scripts you must make sure you have scripting enabled. You should consult with your IT department to see if you are allowed to enable this functionality.\n
For any macro or analytic app – one of the inevitable questions that you may encounter is “how do I configure this to do what I need?” For example, if you build a macro that checks if two fields are equal, but sometimes you want to ignore the case such that “A” equals “a,” and sometimes you want an exact match. This is where the Interface Tool Category comes to the rescue, with a super-tool called Check Box!
Ever needed to learn how to use an Iterative macro? This article walks you through the process with a basic mathematical problem highlighting how the data moves through the macro and loops back to continue processing.
The Dynamic Replace Tool is an under-utilized tool in the Developer Toolset that is very powerful. It allows for dynamic formulas or conditions to be used in your workflow. It was first introduced in Alteryx 6.1. It’s one of the few tools that is currently multi-threaded which makes is fast.
How To: Combine Date Ranges with a Macro
This module (and embedded batch macro) will provide a comprehensive timeline or date range(s) using multiple, overlapping date ranges.
The macro converts date ranges into spatial objects in order to use the spatial functions in Alteryx to group overlapping or adjacent ranges. This ensures that ranges A and C get are grouped together when A and C do not overlap but both A and C overlap range B (and so forth for larger chains of ranges).
It also allows for “jumping” a user-determined number of days in order to combine regions that do not overlap but are within a specified number of days of one another.
Business Problem: Thematic maps are often used to display data geographically with colored or shaded themes, but sometimes users wish to see the data differently. For this purpose, dot density mapping has become a frequently requested feature for map rendering in Alteryx. Dot density creation is possible with the inclusion of the spatial function within the formula tool. This function, ST_Random Point, will randomly disperse a point within a given polygon. Utilizing this tool, anyone can create a macro to produce the data required to generate a dot density map.
Actionable Results: Easily create dot density thematic maps
Overview: It can often be convenient to view thematic maps as clustered points. This type of visual output is a logical and accurate representation of data occurring in a non-continuous distribution. Vertical: Any Key Tools Used: Formula Tool (ST_Random Point spatial function), Generate Rows Required Input: As inputs, the Dot Density macro requires two fields: geography with an associated value and a configuration of the number of dots per value. Determining the appropriate number of dots per value may require some trial and error to produce desirable results. Knowing the min, max, and median values associated with the base geographies would help you to determine and optimal dots per value. This coupled with the size of dots on the map will greatly affect the aesthetic of the mapping.
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.
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.
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.
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.
Convert Polygons to Polylines This macro can be used to convert Polygons into Polylines. In order to use the macro you must specify a spatial field (polygon) as an input.
After running the module all the polygons in the selected spatial field will be converted to polylines. This macro is very useful for when you are putting polygons on an ALTERYX base map and want their boundaries to appear on top of the base map roads. An example would be the mapping of census based Trade Areas. As census Geographies tend to follow roads, they are often obscured by the Alteryx base map. Before Example After Example
Macros Save Time
One of the best time savings tactics for a developer is to create their own macros for repetitive processes. In the case of this macro, an Alteryx user may need to know what week of the year an event falls on. For example, how many transactions occurred during the 23rd week of the year? Accomplishing this task requires formula tools, time/date fields, and come clever parsing to account for leap years.
The first step is to separate the date into its component parts. By separating the date into its component parts, a calculation can be done later in a formula tool that will create a date for January 1st of the year of that specific record.
The next step is to use a Formula tool to divide the [Month] and [Day] fields by themselves, to create a 1/1 date. This date will be compared against the record date to determine how many weeks it has been since the start of the year.
The final step requires several formulas in one Formula Tool to complete the process. Doing math using the Date formula calculations in a Formula tool requires a specific formatting. The first two formulas determine whether the month is a two digit month or a single digit month. The following two formulas detect whether or not a leading 0 is necessary for proper date formatting and inserts it. The fifth formula brings the components together to create the properly formatted yyyy-01-01 date to compare the record date to. The sixth and final formula determines how many days have passed from January 1st to the record date, divides by 7, and rounds up. The result is the week of the year that the record fell on.
There we have it! Please find the formulas and configurations in the attached workflow.