Alteryx Designer Desktop Discussions

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

Dynamic Renaming Columns

TPYN
6 - Meteoroid

Hi,

My Question is about how to ask user rename two mandatory columns.

 

What my app does: I want to fix/clean two columns (Date and Time), cuz most of the time these two columns are messy in field types and column names, and I want to use the app to standardize them. My app already has the function of how to clean up the Date and Time columns.

 

Question: Say a user input a file, his file has date and time column but they are not necessarily named in the correct way the app wants. The app could only clean columns named "Date" and named "Time", but if his file contains time column named "tIMe" or date column named "New date", it would not work.

I want to allow the user to choose the date column in his file, ask him to rename it to "Date", choose the time column in his file, ask him to rename it to "Time". 

Also, the two columns his file has might not be the same field types my app could process. e.g. his Date column is a V-String but my app cleans Date column using Date as field type.

 

Thanks in advance.

 

9 REPLIES 9
TomWelgemoed
12 - Quasar

Maybe it's better not to ask the user, but just to rename it yourself?

 

You can simply use a TitleCase statement in a Dynamic rename tool - see image below.

 

EDIT: Also attaching workflow.


Regards,

Tom

 

Rename.png

TPYN
6 - Meteoroid

Hi Tom,

 

Thank you so much for the reply, i tried what you said and it works well in my workflow. 

when I was trying to add interface, a problem occurs to me.

 

So previously, i was adding dropdown list to allow user choose the time and date column and rename it, but now since i enforce the dynamic rename with titlecase, should i change the action up to the dynamic rename other than the select function?

 

I mean, how will the user know if they should select time / date column when they upload the file? 

 

Thanks so much.

 

TPYN_0-1583356848007.png

 

TomWelgemoed
12 - Quasar

Hi,

 

I see better what you're trying to do now.

 

If the user can select an absolutely random date field (that isn't simply not capitalised correctly), then you do need to create a little app and ask them which fields are the correct ones. I wouldn't bother so much to tell them to correct it, but perhaps just ask them which one you are meant to use.

 

I've created a little app that acts as an example - I haven't tried to make it perfect - but hopefully this helps. The idea is simply to identify the field that is the date (you need to do this separately for time in the macro) and then you can use the user input to carry on with your workflow.

 

Hope that helps.

 

 

macro.png

TPYN
6 - Meteoroid

Hi Tom,

 

Thank so much for the reply, 

this sounds stupid but i am using alteryx 2019.4 and for some reason after I downloaded your workflow i could not open the macro. 

I know this is too much to ask for, could you please share the screenshots of the settings of the macro, record ID and transpose, so i could duplicate the settings in my version of Alteryx?

 

Thanks again. 

TomWelgemoed
12 - Quasar

Apologies for the slow reply, was bedtime!

 

It's no problem - maybe the macro didn't export the way I expected it to. I'm trying to attach only the macro here - it's a really simple/basic setup meant to only prove the point, but hopefully it helps.

 

Regards,

Tom

 

macro.png

TPYN
6 - Meteoroid

Hi Tom,

 

Thank you so much for the reply and of course the wonderful solution, it works.

 

Thanks!

TomWelgemoed
12 - Quasar

Glad to hear it.

 

All the best,

Tom

TPYN
6 - Meteoroid

Hi Tom,

 

I have a follow-up question (sorry i know this is annoying):

I want to filter the data types, since now I completed the process to let user dynamically select the date and time column, the next step would be processing the data itself through the workflow.

However, if the file the user uploaded contains a "date" column and it is a "date type", then i would like the file to go straight to the next step; if the file the user uploaded contains a "date column" and it is not a "date type", instead it is a string type for example, I need to add a convert date function before I could process it.

My question is, is there a filter function where I could filter and examine the data types when the uploaded file comes in? so that I could decide if the file needs to go through the process of converting types or not.

 

Thanks in advance. 

TomWelgemoed
12 - Quasar

Hi @TPYN ,

 

No worries.

 

Try the "dynamic select" tool (it's in the Developer menu). This will only select fields of the data type that you want/are looking for and if you combine it with a search on the field name you should be able to identify all fields containing the text "date" that is truly of date data type.

 

Hope that helps.

Labels