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.

markgraham123
Not applicable

General if statement

Hi,

I'm trying to create a new fileds using and in if statement. But i'm not getting any result.

But a simple if statement is not working. I know there should be something wrong in my syntax.

Can someone please help?

Table1:

LOAD * Inline

[

ID, Name

1,A

1,B

1,C

1,D

1,E

];

Table2:

LOAD *,

If(Name='A' and Name='B' and Name='D' and Name='D' and Name='E' , 'special') as test

Resident Table1;

DROP Table Table1;

Tags (2)
10 Replies
loveisfail
Not applicable

Re: General if statement

May be this?

If(Name='A' or Name='B' or Name='D' or Name='D' or Name='E' , '5', Name) as test

Life is so rich, and we need to respect to the life !!!
robin_hausdoerfer
Not applicable

Re: General if statement

Name cannot be A and B and D ...

it could be A or B fr example

markgraham123
Not applicable

Re: General if statement

No Anil.

ID can have multiple names.

Depending on what names the ID has i havre to create a category field.

Above is one of the example.

markgraham123
Not applicable

Re: General if statement

ID can have multiple names.

Depending on what names the ID has i havre to create a category field.

Above is one of the example.

loveisfail
Not applicable

Re: General if statement

Then, you must explain real data which demonstrates the issue

Life is so rich, and we need to respect to the life !!!
robin_hausdoerfer
Not applicable

Re: General if statement

??? could you elaborate it a bit more please?

vishsaggi
Not applicable

Re: General if statement

Try this may be?

If(Match(Name, 'A','B','C','D','E'), 'Special') as test

el_aprendiz111
Not applicable

Re: General if statement

Hi Mark

/option 1
Table1:
LOAD *, if(WildMatch(Name,'A','B','D','E'),'SPE','OTHER') AS newFieldTest;
LOAD * Inline
[
ID, Name
1,A
1,B
1,C
1,D
1,E
]
;


//option 2
CHRS:MAPPING LOAD * INLINE [
Name, Test
A, SPE
B, SPE
C, OTHER
D, SPE
]
;


Table1:
LOAD *, ApplyMap('CHRS',Name,'OTHER') AS newFieldTest;
LOAD * Inline
[
ID, Name
1,A
1,B
1,C
1,D
1,E
]
;

eduardo_dimperi
Not applicable

Re: General if statement

Mark, i dont know if i right understant, but Id could have multiple values, but only one per line.

Name could be A or B or C or D or E, but not all at the same time.

So change your AND to OR.