how to show/ apply similar method which the macro to included the new/unknown fields like select tools.
i have a sort column macro. where to sort the columns by name. however, it normal that have new field in later of time.
so i dun want to manual update, where is not make any sense.
my current method is do it the reverse way, where only pick the column not to sort.
If instead of a Macro input and you have a file as the first instance, you could try something like this:
This allows the end user to drop the file in the app interface and they will be able to see all fields including new fields that come in without manually updating the list or re-running twice.
If you are saying that new fields appear AFTER an input file tool, then perhaps chaining them would be better.
There is an additional way, I think that will be even easier for the user.
When I have this type of issue I'm creating an external excel file that connected to the macro, without a Browser tool, it has a fixed location.
In the file there is the full list of all the fields and there is a number next to each one that indicate it position. When there are new fields the guys need to add the new field to the excel and override the numbers to have the new sequence. now when running the automation the new fields will be taken into consideration and you will have them in the correct order as you can sort them based on their numbers.
With a Dynamic Renaming you can replace the numbers with the headers and they will always be in the correct order.
thank you, but macros are shortcut build for developers. so both ways may not apply to my situation. where it require more action when using it.
imagine it have a monthly report just have a new month in the end. i want to sort the months accordingly by using this macro.
in this case, i prefer i can set it one-off, so that neither user nor I need to touch it as it is a fixed rule, make no sense to click everytime.
of cause, i know the manual ways (by adjusting *unknown field in select tool, or adjust name before crosstab),
but i want this "*unknown" field are apply to other macro i built where I think i should have a better way to do it.
i will raised an idea for this: *unknown field for interactive list tools. - Alteryx Community
I'm not sure I understand the issue here. Your list box is connected to the Q of the Macro Input and so it will load with the list of fields from whatever is connected to the Macro Input. So, the user will be able to choose from the actual list of fields.
If you do not want the user to pick, then you need to create that rule for them. An easy way to take an unknown number of fields and order them is to transpose those headers, summarize and then sort the name column and record ID. You now have a lookup table that you can use to rename, re-order etc and it's dynamic.
If this is is a situation where you're using months -> specifically and you want to apply a sort order -> you would create a logic to map your month column names to a month value -> and then perform a sort/reordering using some combo of field info or transpos, field info -> and then dynamic rename where you take your columns names from the right datastream (which has a map of month/ month in numeric order) -> you can then dynamically select/sort. I'd also recommend looking at dynamic select to filter for fields which match specific dynamic requirements -> and then dynamic rename to create a static name (like 'most recent month') -> you can then use that static name in a summarize tool.
@KGT okay, i think you confuse on who is user.
user -> who ran the macro via server.
when user ran the workflow, he can't see the macro configuration.
so i need a method to handle these new field in workflows. (where "*unknown" field will help here. to bring the new field name in to the macro.)
and yes, non-macro ways are definitely work.
but now i try to build some macros for exploration purpose, and it easier for new alteryx developer to use.
So the case i written above is just one for the situations, it will lot more of case where unknown field should be handled.
eg:
1. data cleansing tool to covers unknown columns.
2. sort data within rows (3,1,2 -> 1,2,3) without change the header name
3. sum data within rows
4. concat multi-row into headers
5. demote header into rows
where "*unknown" field will make them to cover more situation instead of one-off/ fixed columns.
@apathetichell good idea to use dynamic select. I can create another option to use textbox to input expression into dynamic select.
User | Count |
---|---|
77 | |
58 | |
53 | |
47 | |
38 |