Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Problem with simple if statement containing "and"

Hi,

This statement is not working for me.

Anyone got a clue of what is wrong?

If("t_invc"=1 and "t_rtrn"=0,1,0) as Flag_InternalSales, // 1=Yes,0=No

Freddy

Tags (2)
1 Solution

Accepted Solutions
Not applicable

Re: Problem with simple if statement containing "and"

Hi. Sorry guys. "t_rtrn" do not have 0 as a value. Only 1 and 2. That explains it. Thanks again.

7 Replies
nilo_pontes
Contributor

Re: Problem with simple if statement containing "and"

Remove the quotes Freddy

Regards,

Nilo

Re: Problem with simple if statement containing "and"

If(t_invc=1 and t_rtrn=0,1,0) as Flag_InternalSales



Not applicable

Re: Problem with simple if statement containing "and"

Hi, thanks for the input. Do not work to remove quotes as the data model has these quotes from the database.

jer_2011
Contributor II

Re: Problem with simple if statement containing "and"

hello try so If(t_invc=1 or t_rtrn=0,1,0) as Flag_InternalSales

Not applicable

Re: Problem with simple if statement containing "and"

Hi. Sorry guys. "t_rtrn" do not have 0 as a value. Only 1 and 2. That explains it. Thanks again.

stigchel
Honored Contributor

Re: Problem with simple if statement containing "and"

I'm not sure about the quotes, I would remove them in load script.

If not possible you can try if this helps (not sure):

If(["t_invc"]=1 and ["t_rtrn"]=0,1,0) as Flag_InternalSales

Not applicable

Re: Problem with simple if statement containing "and"

Try with this:

If("t_invc"=1, if("t_rtrn"=0,1,0)) as Flag_InternalSales, // 1=Yes,0=No