Alteryx Designer Desktop Discussions

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

Add 0 where length is not 9

Farriyajawed
7 - Meteor

I have numbers like 1170.0000 and the length is 9.

 

I have some like 1170.001 and the length is 8. 

 

I need to add a 0 everywhere the length is not 9. 

4 REPLIES 4
apathetichell
18 - Pollux

are they numbers? are they strings? what about 11700.0001? padright can work for strings - for numbers - you'd want to convert to fixed decimal.

BS_THE_ANALYST
14 - Magnetar

Not all numbers will be in the thousands? Are you actually just trying to ensure there will always be 4 decimal places? I think this could be quite troublesome. What happens if some values are already more than length of 9?

 

Here's a method to get what you want, but I don't think it's ideal: PadRight([column here], 9, "0")

ChrisTX
15 - Aurora

Try the attached workflow.  You can combine all of the formulas into one, but I left them separate to make it easier to understand.

 

If your input value is a string, you won't need the first formula.

 

This is just to point you in the right direction.  You'll need to account for the overall length of 9 that you're trying to test for.

 

Screenshot 2023-10-23 123829.png

 

Chris

Qiu
20 - Arcturus
20 - Arcturus

@Farriyajawed 
I would agree with @apathetichell 
If it is string, PadRight should work and it if it is numeric then FixeDecimal.

Labels