Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

IF Statement

Hi,

Need help transferring this logic into an IF statement.

IF Fieldname  = '1111' or '1112' or '1113' or '11233','ID' AS CODENAME

4 Replies
its_anandrjs
Champion III
Champion III

Write like

IF(Match(Fieldname,'1111','1112','1113','11233'),'ID') AS CODENAME

hic
Former Employee
Former Employee

Small correction: You probably want ID to be a field reference. Then you cannot use single quotes. You need double quotes, or square brackets:

     IF(Match(Fieldname,'1111','1112','1113','11233'),"ID") AS CODENAME

HIC

its_anandrjs
Champion III
Champion III

Thanks HIC but if ID is as string then it will use like 'ID' or if it is field reference then it will use like

1. If ID is field reference from table then


IF(Match(Fieldname,'1111','1112','1113','11233'),"ID") AS CODENAME

Or

IF(Match(Fieldname,'1111','1112','1113','11233'),[ID]) AS CODENAME



2.If ID is string then it will use like

IF(Match(Fieldname,'1111','1112','1113','11233'),'ID') AS CODENAME


nizamsha
Specialist II
Specialist II

Your r near to the code wht u want some correction check this one

TableA:

LOAD *,if(ID='5'or ID='4',ID) as ID1;

LOAD * Inline [

ID,Amount

1,10

2,20

3,30

4,40

5,50

];