Alteryx Designer Desktop Discussions

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

Getting a desired format as an output for Numbers and texts

db89
8 - Asteroid

Hi All,

Hope you are doing good!
I ran into a situation where in a column I have specific codes like:
8.1
79.12G
68.FD

Then I would get the desired output in the following format such that 8.1 gets converted into text as 8.10 but the other texts should not change:
8.10
79.12G
68.FD

 

If this is possible then it would be great if someone can guide on this. Thanks!

6 REPLIES 6
PhilipMannering
16 - Nebula
16 - Nebula

What about?

padright([Field1], 5, '0')

This works for the data your provided.

ShankerV
17 - Castor

Hi @db89 

 

One way of doing this.

 

ShankerV_0-1681908796294.png

 

IF REGEX_Match(Right([INPUT],1),"\d") = -1
THEN [INPUT]+"0"
ELSE [INPUT]
ENDIF

 

ShankerV_0-1681908859687.png

 

Many thanks

Shanker V

db89
8 - Asteroid

hi @ShankerV  the formula works but it adds 0 at the end of those texts which dont have a " . "
lets say if i add 821 then it becomes 8210

ShankerV
17 - Castor

Hi @db89 

 

Please find the amended formula.

 

ShankerV_0-1681913807191.png

 

IF !Contains([INPUT], ".")
THEN [INPUT]
ELSEIF REGEX_Match(Right([INPUT],1),"\d") = -1
THEN [INPUT]+"0"
ELSE [INPUT]
ENDIF

 

ShankerV_1-1681913828214.png

 

 

Many thanks

Shanker V

db89
8 - Asteroid

Hey @ShankerV  that works really well! There is one tiny problem which is setting it off, is lets say if i have a decimal no. 87.377 then alteryx is throwing it as 87.376999999. Can we control the same in the same formula you used? None the less, thank you so much! :)

binuacs
20 - Arcturus

@db89 Another method

binuacs_0-1681923920866.png

 

Labels