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

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
20 - Arcturus

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
15 - Aurora
15 - Aurora

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")

All the best,
BS

LinkedIN

Bulien
ChrisTX
16 - Nebula
16 - Nebula

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
21 - Polaris
21 - Polaris

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

Labels
Top Solution Authors