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.
I'm building a macro that reads the fields present in an input file and uses them to populate a dropdown menu. The resulting selection is passed into a Formula tool. If the original field name contains no spaces or strange characters (-, /, maybe more), it works perfectly. If the field *does* contain those characters, as in "E-Mail" or "Zip Code", the result will be passed as "E" or "Zip" respectively. Because there *is* no variable/field named "E", that's as far as it gets and throws an 'unknown variable' error.
I'm sure there is a simple solution, but I'm stuck *so* close to having a working macro.
it depends what you want to happen when there is a None section, it's certainly possible but more complicated. In this case I'd use an action to "Replace with Formula" and then craft individual formula to add into the tool depending on the selection. It's harder because you need to watch your quotes.
e.g. if the formula was as above but we wanted to set everything to Low when the Dropdown was "None" I'd use a Replace with Formula action with the following formula:
IF [Dropdown] = 'None' then '"None"' else 'IF [' +[Dropdown]+'] > 100 then "High" else "Low" endif' endif
Note how I'm mixing up Single and Double quotes to ensure they parse correctly when they get passed into the Formula.
'Update Value with Formula' -> Perfect. Much simpler code, too.
if isempty([#1]) then '""' else '['+[#1]+']' endif
Thanks again. I'm just finishing building a macro that will add a set of our standard fields at the beginning of an input file, with dropdowns for field mapping, populated by the fields in the macro input. Not too shabby for my first week using Alteryx. Quite a product you guys have, here.