Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

If statement

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!

1 Solution

Accepted Solutions
Not applicable
Author

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;

View solution in original post

12 Replies
Not applicable
Author

if((Active = 'No',1,0) AS ActiveInt

This statement assumes you are not dealing with a 3 state boolean (Yes, No, Null)

Not applicable
Author

Where in the script is it supposed to go?

Not applicable
Author

Just put it as a new field in your load script

mphekin12
Specialist
Specialist

Something like this may work:

if(Active='No',1,

     if(Active='Yes',0,'')

) AS ActiveFlag

Not applicable
Author

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?

mphekin12
Specialist
Specialist

Can you post a sample app?

Not applicable
Author

Are you trying to do this in the UI or backend can you give us a file to work with?

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Check with this

     Load

          Active,

          Pick(MixMatch(Trim(Active), 'Yes', 'No'), 1, 0) AS ActiveFlag

     .

     .

     FROM

Celambarasan

Not applicable
Author

 

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;