We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Replace Char Issue

gauravnegi2
8 - Asteroid

Hi,

 

Facing an Issue with one of my formulas 

 

Input given =1234567890

 

Formula Used = ReplaceChar(ReplaceChar(ReplaceChar(ReplaceChar(ReplaceChar(ReplaceChar(ReplaceChar(ReplaceChar(ReplaceChar(ReplaceChar([ID],"1","0"), "2","9"),"3","8"),"4","7"),"5","6"),"6","5"),"7","4"),"8","3"),"9","2"),"0","1")

 

Output =1234554321

 

Desired Output =0987654321

 

Please help, 

Thanks in advance.

13 REPLIES 13
ImadZidan
12 - Quasar

Hello @gauravnegi2 ,

 

This is a reverse function.

 

Attached is an idea.

 

Hope it helps

PhilipMannering
16 - Nebula
16 - Nebula

Perhaps this might work. See attached.

 

otherwise convert the field to string and use the find and replace tool would also work.

 

 

gauravnegi2
8 - Asteroid

Hi @ImadZidan  @PhilipMannering ,

 

Actually this a sample data the use-case is bit different

 

For example:- I have a string "UA12GF43" and the Output i want is "UA09GF78" .

 

 

ImadZidan
12 - Quasar

Hello @gauravnegi2 ,

 

I had a feeling its more thank a reverse.

However, I fail to understand the connection between the strings in the example and the order.

How did you workout the transformation from "UA12GF43" To "UA09GF78" .

 

 

ImadZidan
12 - Quasar

Hello @gauravnegi2 ,

 

I see what you are doing. I looked at the replace functions you have wrote.

 

This will give you an idea.

vizAlter
12 - Quasar

@gauravnegi2 — And, if you just want to reverse the order of any value (String/Numeric), then refer to the attached workflow.

 

Input given =1234567890

Desired Output =0987654321

 

Input given ="AB 12CD"

Desired Output ="DC21 BA"

 

 

If this post assists in resolving the question, please mark it "Like", or "Solved" if it resolves the question. This will help other users find the same answer/resolution.  Thank you.

grazitti_sapna
17 - Castor

Hi @gauravnegi2 , by using reversestring() function yur problem can be solved, please have a look.

 

grazitti_sapna_0-1598248488973.png

Thanks.

Sapna Gupta
gauravnegi2
8 - Asteroid

@vizAlter @grazitti_sapna @gr I don't want to reverse the whole string but i want to change the number in an order

Initial no     replaced by

1-0

2-9

3-8

4-7

5-6

6-5

7-4

8-3

9-2

0-1

 

For example:- I have a string "UA12GF43" and the Output i want is "UA09GF78" . Only the number should be replaced.

 

by find and replace tool we can achieve this by putting a mapping file but my requirement is with formula tool  

gauravnegi2
8 - Asteroid

Hi @ImadZidan,

 

Yes we can do it through Replace function but when we going to build a macro to implement  this for multiple column it won't work, that's why i have to do it in Formula 

 

Labels
Top Solution Authors