Alteryx Designer Desktop Discussions

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

Multiple Find and Replace

MohammedBurhaan
6 - Meteoroid
Account NoNameEmail Subject LineDesired Output_Email Subject Line
111JackHi [Name] - Your account is [Account No]Hi Jack - Your account is 111
222RobHi [Name] - Greetings.Hi Rob - Greetings.
333LouisHi - Greetings.Hi - Greetings.

 

Hi guys,

I would want a solution to the above, I have a field 'Email Subject Line' which might or might not need the data contained in other fields, I want a dynamic mechanism by which I can read the 'Email Subject Line' and just replace the fields of variables with exact variable values.

 

I would want a way to get that as show in the last column 'Desired Output_Email Subject Line'

Please note that, it can have any number of variables in it, sometimes 0 or sometimes 10 or any number of variables names of the available columns in it.

 

Please help

Thanks

14 REPLIES 14
BS_THE_ANALYST
14 - Magnetar

@flying008 forgive me if I'm wrong (I don't use and have never used the dynamic replace) but it seems like you're using the SWITCH function to manually target certain instances of [brackets] in the string. This is not at all dynamic if you need to declare the string you want to replace. My interpretation of dynamic is that the solution will take unseen things into account, still work, and still solve.

 

With that being said, if we used a field info tool in combination with a batch macro we could directly overwrite the formula configuration for the switch function so that it encompasses all current and future columns as the formula tool's configuration will be updated dynamically per run with any columns names. Failing that, we drop the formula tool as the switch function is nothing more than a alternative to find and replace and we just create a text input inside the batch macro with a find and replace?

 

@flying008 let me know if this idea is an improvement to your solution or I'm just talking crap and your solution already takes this into account. I'm a rookie with the dynamic replace. If your solution does already take this into account, please can you share your workflow so I can learn from it?

 

Yes, I'm assuming every instance of "[xyz]" in the text would require replacing with it's respective column if there is a column called "xyz" available. I think this is reasonable for a dynamic solution. Otherwise, manual targeted replacement which I assume you provided above will suffice.

 

All the best,

BS

flying008
14 - Magnetar

Hi, @BS_THE_ANALYST 

 

I'm just using the Switch function here to let Dynamic Replace tool determine which field to match, not to manually locate the string, and the key to using the formula here is to convert the original string into a formula with references, which is the core of Dynamic Replace tool.


Of course, what is avoided here is the fact that the field name in [] does not exist, as @gawa  said, and whether the CaseN of the Switch function has a hierarchical restriction similar to that of the Excel If function (e.g. 7 or 255), because the Alteryx help does not make this clear.

 

IMHO, it should be appropriate to use Dynamic Replace tool in this scenario, because it can be really replaced on the fly without manual positioning, and once the formula is created, the formula can be dynamically updated and output the corresponding result every time it runs, regardless of the increase or decrease in the name of the reference character column or the name change.

 

******

I'm sorry, because of the restrictions of the security policy, I can't upload any workflow files, so here is the animation for your reference.

 

录制_2024_03_18_09_16_05_345.gif

BS_THE_ANALYST
14 - Magnetar

@flying008 thank you for showing the tool configuration, I can follow this perfectly. This is indeed dynamic, very cool stuff. I'll most certainly explore this today.

 

Every day is a school day 😎.

 

All the best,

BS

MohammedBurhaan
6 - Meteoroid

Hey All,

 

Loved the response, and the enthusiasm from everyone.
I've got a bigger challenge here - 

Please try to help me out on this - https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/How-to-generate-email-with-a-t...

flying008
14 - Magnetar

Hi, @MohammedBurhaan 

 

If can help you get your want, please mark it as a solution and give a like for more share.

Labels