community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Find and replace text within a formula expression

Meteor

I want to replace specific text within a formula expression. Is there a way to do find and replace of text within a formula expression? I can copy the entire expression outside of Alteryx and quickly do a find and replace and then copy the revised expression back into Alteryx but that is obviously not an ideal solution.

Quasar

Hi @tlewis .

A sample input and output can help  community.

Alteryx
Alteryx

Hi @tlewis 

 

How many replacements are you doing?

 

If it is only one or two, then you can use a Formula Tool - Replace([Field], "Find", "Replacement")

 

Let me know if that works for you

 

Kind Regards

Will

Alteryx
Alteryx

hi @tlewis ,

 

is this for building the workflow or for production?

How many times you need to replace a section within an expression?

 

If it is in production you can think of Applications, you can use an action tool that replaces the value that you have on your expression. 

 

Can you give more context around what you want to achieve at the end?

 

Best,

Vianney

Meteor

I am actually trying to update several different fields within a formula tool. Each field was initially built using a hardcoded year of 2013 in the formula expression. Here is an example of just one field:

IF (DateTimeMonth([DOD]) < 7)
THEN (2013+4) - DateTimeYear([DOD]) + 1
ELSE (2013+4) - DateTimeYear([DOD])
ENDIF

 

I want to change this formula expression (and all the others) to look like this:

IF (DateTimeMonth([DOD]) < 7)
THEN ([Study Start Year] +4) - DateTimeYear([DOD]) + 1
ELSE ([Study Start Year] +4) - DateTimeYear([DOD])
ENDIF

Nebula
Nebula

Hi @tlewis 

 

There's no way to automate this in Designer.  If you've only got a few changes to make, do them by hand.  More than ~10, then .yxmd files are just XML.  Find and replace in NotePad++, or even an Alteryx workflow will make all the changes for you.  Just make sure to take a backup first.

 

Dan

Labels