Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

keep multiple zeroes in a string?

matthew_swanson
7 - Meteor

i have this formula.. most (but not all) of the values in this field are null. what i'm trying to do is replace null with '00000000', but alteryx keeps interpreting that as '0'.. how can i keep all 8 zeroes?

 

matthew_swanson_0-1621265992586.png

 

4 REPLIES 4
atcodedog05
22 - Nova
22 - Nova

Hi @matthew_swanson 

 

Your formula should be

 

If [KOSTL (COST_CENTER)]=null() then "00000000"

Else [KOSTL (COST_CENTER)]

Endif

 

Currently whats happening is [KOSTL (COST_CENTER)] = "00000000" is a sub condition which is retuning false i,e 0

atcodedog05_0-1621266440234.png

 

Hope this helps 🙂

Luke_C
17 - Castor
17 - Castor

Hi @matthew_swanson 

 

What is likely happening is this field is set to be numeric. Since you are trying to insert a string "000000", alteryx cannot convert that to be numeric and puts 0 as the default. I'd suggest using a select tool to update the data type, or creating a new field in the formula tool that is a string.

 

Also, your first clause could be simplified to 'if isnull([KOSTL (COST_CENTER)]) then...'

 

edit: good eyes @atcodedog05 that's definitely the issue

matthew_swanson
7 - Meteor

@atcodedog05  wow, that was a big oversight on my part. thanks for the help

 

also, sorry for posting so many stupid questions to this board, haha

atcodedog05
22 - Nova
22 - Nova

Hi @matthew_swanson 

 

Happy to help 🙂

 

Nope, its not a stupid question. If you hesitate to ask questions thinking they are stupid, you will miss out on learning lot of things 🙂

Labels
Top Solution Authors