Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I want to use an If statement in my script to change values in my "Active" column from 'No' to 1 and "yes" to zero.
Been trying but I must be doing something wrong.
Thanks!
LOAD "User_ID",
"User_Name",
"First_Name",
"Last_Name",
(Inactive) as Active,
SSO,
1 as MFCount,
if((Inactive) ='No',1,0) AS ActiveFlag;
SQL SELECT * FROM IDONTKNOWWHAT;
if((Active = 'No',1,0) AS ActiveInt
This statement assumes you are not dealing with a 3 state boolean (Yes, No, Null)
Where in the script is it supposed to go?
Just put it as a new field in your load script
Something like this may work:
if(Active='No',1,
if(Active='Yes',0,'')
) AS ActiveFlag
I put it in and it loads but does not change the text to the specified numbers. Not sure why it ran then? Any other ideas?
Can you post a sample app?
Are you trying to do this in the UI or backend can you give us a file to work with?
Hi,
Check with this
Load
Active,
Pick(MixMatch(Trim(Active), 'Yes', 'No'), 1, 0) AS ActiveFlag
.
.
FROM
Celambarasan
LOAD
"User_ID",
"User_Name",
"First_Name",
"Last_Name",
(Inactive) as Active,
SSO,
1 as MFCount,
if(Inactive='No',1,
if(Inactive='Yes',0,'')) AS ActiveFlag;