Alteryx Designer Desktop Discussions

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

Copying formulas from one formula tool to the other

gabrielre
6 - Meteoroid

Hello! hoping someone might have a way around this. I have a set of formulas done in one Formula tool to add in new columns.

Now I need to replicate all these formulas to existing formula tools in my workflow. What would be the best way for doing this?

 

4 REPLIES 4
Prometheus
12 - Quasar

You could copy the Formula tool, delete the other Formula tools, then paste the one you copied to replace those you deleted. If you're really ambitious, you could open your workflow in Notepad++, search for the formulas you want to add to the other Formula tools, copy and paste them under those tools and save. Next time you open your workflow, your Formula tools will have the formula(s) you copied from the one. 

KamenRider
11 - Bolide

Please expand by citing examples and screenshots.

 

Thanks,

Kamen

Prometheus
12 - Quasar

Here's the before shot, where I have two expression in my original Formula tool and two test Formula tools with just text in them.

Before.PNG

After I saved, right-click on the file and click on "Edit with Notepad++". Click on Ctrl-F then click on "Find All in Current Document," so you can search for the word "formula" wherever it exists in the file.

Find.PNG

This is what I found:

Found.PNG

What I was looking for was the formula I wanted to copy. This is it:

One Formula Tool.PNG

So I copied and pasted the two middle lines to replace "<FormulaField expression="'Test1'" field="Test1 Formula Tool" size="1073741823" type="V_WString" />" and "<FormulaField expression="'Test2'" field="Test2 Formula Tool" size="1073741823" type="V_WString" />" then saved it with a new version number and with the file extension .yxmd.

Save As.PNG

When I opened the new file in Designer, I can then see my original Formula tool unchanged and now my two others have the formulas I copied and pasted into them from Notepad++.

Test1 Formula After.PNG

Test2 Formula After.PNG

 

**Be careful, though. Don't overwrite the original file in case you make a mistake.

Prometheus
12 - Quasar

Here's the before, where I have my original Formula tool with two expressions in it and two other formulas tools with just text in them -- Test1 and Test2.

Before.PNG

I saved it and then went to the file location in my folder and right-clicked it. Then I selected "Edit with Notepad++." Once I had it open I clicked on Ctrl-F to bring up the Find window. I entered the word "formula" in the search bar and clicked on "Find All in Current Document."

Find.PNG

Notepad++ opens up a window at the bottom with my search results.

Found.PNG

What I was looking for was this:

One Formula Tool.PNG

These are the two expressions I want to keep and copy to my other Formula tools.

<FormulaField expression="DateTimeAdd([Qtr End Date],1,'days')" field="First of Month" size="10" type="Date" />
<FormulaField expression="DateTimeAdd(DateTimeAdd([First of Month], -3, 'months'),-1,'days')" field="Last Qtr End Date" size="10" type="Date" />

 

Then I pasted it to replace <FormulaField expression="'Test1'" field="Test1 Formula Tool" size="1073741823" type="V_WString" />. And then pasted it again to replace  <FormulaField expression="'Test2'" field="Test2 Formula Tool" size="1073741823" type="V_WString" />.

 

Then I saved the file with a different version number so I didn't overwrite my original file. 

Save As.PNG

As you can see, both new Formula tools have both expressions in them now.

Test1 Formula After.PNG

Test2 Formula After.PNG

 

This may be the long way, though. You could just update the XML in the workflow: https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/Copying-of-formulas/td-p/91541...

Labels