Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Qlik Analytics Tour 2020 Online. Begins August 10th. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor II
Contributor II

If condition

Hi all,

One more question in writing a If condition!!

I am trying to filter data using if condition where I need to compare two fields. For example:

Let the fields be

1.Flag:  which has only 1 and 0 value in it.

2. Name: This field has data something like this

Name

abc

bcd

rfg

3. Cname

4. Num : This field has data something like this :

Num          

1234557

4567869

7864325

abc_123

bcd_567

rfg_675.


Note :Starting of some data in Num field resembles the data in Name. For example

Name                  Num

abc                    abc_123

bcd                   bcd_567

rfg                     rfg_675.


I need to bucket in the data for a field called "room" for a condition

Flag =1 or

Num = only that data which Starts with Name field.( Example = abc_123, bcd_567, rfg_675).


So expression should be like

If( Flag ='1' or Num = ' Like Name', Name, Cname) as room.

I hope I have explained in a simple way. Thank you.

Regards,

PV

1 Solution

Accepted Solutions
Highlighted
Partner
Partner

Re: If condition

There was a Typo. Please use below expression

if( Flag=1 or  WildMatch(Num, '*' & Name & '*'), Name, Cname)  as room

View solution in original post

7 Replies
Highlighted
Partner
Partner

Re: If condition

Hi,

Try below script.

if( Flag=1 or  WildMatch(Num, '*' & Name & '*', Name, Cname)  as room

Highlighted
Partner
Partner

Re: If condition

There was a Typo. Please use below expression

if( Flag=1 or  WildMatch(Num, '*' & Name & '*'), Name, Cname)  as room

View solution in original post

Highlighted

Re: If condition

May be use this If( Flag =1 or Num like Name, Name, Cname) as room

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Highlighted
Contributor II
Contributor II

Re: If condition

Hi Krishnapriya,

Thanks for the reply, I am getting the data when the condition is true but this time it's not bucketing the data if condition is false. That means the values for Cname are not populating.

Highlighted
Partner
Partner

Re: If condition

I have verified with sample data, both true and false case is working fine.

Please find attached sample.

share me the false condition which is failing.

Highlighted
Contributor II
Contributor II

Re: If condition

Thank you Krishnapriya, it's working.

Highlighted
Partner
Partner

Re: If condition

Great. Please mark the correct answer and close the thread.