Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

database wide y to 1 and n to 0 replacement

ffery
5 - Atom

hi

I have large database with multiple columns - all have n or y

 

I want to replace all y with 1 and all n with 0

 

tried a few formulas no luck

Col1Col2Col3Col4Col5Col6Col7Col8
nnnnnnnn
nnnnynnn
nnynynnn
nnynnnny
ynnnnnnn
nnynnnyn
nnnnnnnn
nnnnnnnn
nnnnnnnn
nnnnnnnn
nnnnnnnn
nnnnnnnn
nnnnnnnn
nnnnnnnn
nnnnnnnn
ynyynnnn
nnnnynnn
nnnnnnnn
nnnnnnnn
nnnnynnn
nnnnnnnn
2 REPLIES 2
JosephSerpis
17 - Castor
17 - Castor

Hi @ffery a Multi-Field tool might be an approach as it has the ability to apply formulas across multiple columns and apply them to dynamic/unknown fields. I mocked up a workflow let me know what you think? 

atcodedog05
22 - Nova
22 - Nova

Hi @ffery ,

 

Here is a workflow for the task.

 

Use this formula in Multi-Column Formula tool. Select all columns

IF [_CurrentField_]='y' THEN 1
ElseIF [_CurrentField_]='n' THEN 0 
Else Null() 
ENDIF

Input

atcodedog05_0-1601404732135.png

Output

atcodedog05_1-1601404751155.png

 

Hope this helps : )

 

If this helps please mark this post as a solution

Labels
Top Solution Authors