Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

How to use the the dropdown tool to map fields in the select tool?

avanibhatnagar
8 - Asteroid

Hi,

 

I have an Alteryx Analytic App which asks for the input files from the users and then processes them. The user can have different field names than the placeholder/sample file I have in the workflow. So I use the Dropdown Interface tools to allow them to map the fields in their file to the required fields. (see attached workflow)

 

My expected output is that their fields are renamed to the my placeholder file's fieldnames. The issue I have is that once I use the test file to run this App, I get the excel output but the column names don't update to my placeholder file's fields. It just outputs the testfile that I upload. What am I doing wrong to get the output to have the renamed columns to match my placeholder field names?

 

Any help/suggestions are appreciated! 

 

 

8 REPLIES 8
phottovy
13 - Pulsar
13 - Pulsar

Hi @avanibhatnagar ,

 

I modified your workflow slightly. This might be possible using the standard select tool but I switched it to a dynamic rename tool with an if statement. With this method, it looks for match for the column name the user selects for both fields then updates them to a label of your choosing. This would be a bit of a pain if you have a lot of columns to rename but with only two, it isn't bad.

csmith11
11 - Bolide

1st off this use case is very common, and your approach for it is very clever.

 

2nd, since you posted here 37 mins ago I image you already found the solution, considering how close you were already!

 

You action tool was configured to update the Parent of the select field (StateName):

csmith11_2-1630697113693.png

 

 

 

But you need to update the child element (@field - value='StateName'):

csmith11_3-1630697140326.png

 

You were off by just one row, like I said you likely already figure this out! Just posting here for anyone else that comes across the same problem.

 

Something else to keep in mind if you haven't already caught this, the rename value for StateName has a trailing space. You may need to remove that as well.

 

csmith11_5-1630697645463.png

 

 

 

phottovy
13 - Pulsar
13 - Pulsar

@csmith11 is right! I was overthinking the question. Their solution is a more straightforward answer to your problem.

avanibhatnagar
8 - Asteroid

@csmith11 I did not figure it out until you mentioned it. It's like missing that one space/semicolon while coding! Thanks a lot - appreciate the Alteryx community so much! 

 

@phottovy Thanks for trying!! 🙂 

avanibhatnagar
8 - Asteroid

@csmith11 Since you mentioned that this is a common use case - I wanted to ask if you knew whether it can be converted to a macro - so if I have a lot of fields (hence a lot of questions) is there a way I can just insert the macro and add all questions or I'd just have to add all tools to the workflow for each question?

csmith11
11 - Bolide

I'm glad you asked this. 

 

I just had this same discussion in an Alteryx Class I teach.

 

Here is an idea of how you might map multiple fields at the same time:

 

Lets say the following headers are the field names you are using down stream in your workflow.

 

csmith11_0-1631118511785.png

 

But these are the Headers that your user wants to import:

csmith11_1-1631118598733.png

 

You can leverage a Dynamic Rename Tool Right After your initial File Browse using the "Take Fields From Right Input Rows" configuration.

 

For the Right Input, you'll want to connect a Field Map file. This can be an excel file that shows a list of the End Users fields, and the appropriate field they wish map to in your workflow.

 

csmith11_2-1631118743974.png

 

This will rename their imported fields to the Mapped field indicated producing a result very similar to your select tool method.

 

I've attached an example App, with a testInput file as well as a FieldMapFile. 

 

Please let me know if you are able to make sense of it all.

 

 

 

avanibhatnagar
8 - Asteroid

That's a nice approach. The only issue in my scenario is that I can't provide a field mapping because I don't know what the user plans to call the field - there isn't a list of fields I know that needs to be mapped to my required fields. So this might not work for me and I might have to just do multiple tools for each field. 

csmith11
11 - Bolide

The solution I provided with the Field Map example, would require the end user to manually map his data fields himself in an Excel sheet. You would provide him with a template indicating the fields your workflow contains. This process requires more documentation and instruction. It isn't as user friendly as using a dropdown tools for each field as you mentioned.

 

Your method is definitely the preferred when mapping only a limited number of fields. However, if the number of fields that need to be mapped becomes numerous, I believe the Field Map method may be preferred. It may just come down to personal preferences.

 

 

Labels