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

In Database replace null with 0

akasubi
8 - Asteroid

Hi,

 

I have a dataset via in-DB tool which includes null values that i would like to replace with 0. I'll be making calculations on the columns using the formula in-db tool, but it currently doesn't read these null values so the output remains null.

 

I understand we can use the data cleanse tool, but i'll need to data stream out in order to do this and the second part of the workflow involves the calculations so i'm not sure how i'd get the data back in.

 

Does anyone know what is the best way to go about this?

 

 

Thanks

afk

5 REPLIES 5
Thableaus
17 - Castor
17 - Castor

Hi @akasubi 

 

Which database provider are you using?

 

Cheers,

Thableaus
17 - Castor
17 - Castor

@akasubi 

 

If you use Formula In-DB with SQL Server, this will work.

 

ISNULL([Field], 0)

 

If it's Oracle:

NVL([Field], 0)

 

If it's MySQL

IFNULL([Field], 0)

 

Cheers,

akasubi
8 - Asteroid

Hi @Thableaus 

 

I'm using SQL Server.

 

Will I need to input the formula for all fields affected? The multi-field formula tool is quite handy as I could convert multiple fields at the same time.

 

Thanks

afk

Thableaus
17 - Castor
17 - Castor

@akasubi 

 

There's no Multi-Field formula In-DB.

 

Are there many fields? Because the function is very short, you can use a single Formula In-DB tool and just paste the field names into the function.


Cheers,

akasubi
8 - Asteroid

@Thableaus 

 

Yeah, quite a few fields with possibility of more fields added in future. Data cleanse tool also allowed me to retain the column name without having to change it. (i actually meant data cleanse in an earlier response as opposed to multi-field formula).

 

Guess writing the formula would be my only solution for the moment.

 

Will give it a go, thank you!

 

Labels
Top Solution Authors