Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
peterkumar
Contributor III
Contributor III

Question on If(Exists(fieldname)...

Hello - I am new to QlikView and will greatly appreciate guidance on the following -

In the code below, field  [WCPA Actuals] takes on different values depending on whether field Eligible Key is in the WCPAlist of Eligible Keys. 


How do i make it happen in the FinalData load?

WCPAlist:

Noconcatenate

Load

[Eligible Key]

From CasMap where Coverage = ‘WCPA’;

FinalData:

Noconcatenate

Load

[Eligible Key], 

[Account Name],

[Create Date],

[Modified Date],

If(Exists([Eligible Key], ’WCPA’ ,’N/A’) as [WCPA Actuals]

Resident MasterTable;

WILL IF(EXISTS([Eligible Key]  above WORK?

Many thanks!

1 Solution

Accepted Solutions
sunny_talwar

I think there it is a single quote issue

If(Exists(CheckKey,[Eligible Key]),WCPA,’N/A’) as [WCPA Actual]


Try this:


If(Exists(CheckKey,[Eligible Key]),'WCPA',’N/A’) as [WCPA Actual]

View solution in original post

4 Replies
sunny_talwar

Try like this:

WCPAlist:

NoConcatenate

LOAD [Eligible Key] as CheckKey

From CasMap

Where Coverage = ‘WCPA’;

FinalData:

NoConcatenate

LOAD [Eligible Key],

[Account Name],

[Create Date],

[Modified Date],

If(Exists(CheckKey, [Eligible Key]), ’WCPA’ ,’N/A’) as [WCPA Actuals]

Resident MasterTable;

peterkumar
Contributor III
Contributor III
Author

Thanks Sunny.  For some reason that is not working.  Error I get is  -

Field not found - <’WCPA’>
FinalData:
NoConcatenate

LOAD [Eligible Key],
     [Company Number],
     Source,
     [Account Name],
     Coverage,
     [Forecast Effective Date],
     [Create Date],
     [Modified Date],
     [Selected Loss Pick],
 
     If(Exists(CheckKey,[Eligible Key]),’WCPA’,’N/A’) as [WCPA Actual],
  
     [WCPA Create Date]
FROM

(txt, utf8, embedded labels, delimiter is ',', msq)

sunny_talwar

I think there it is a single quote issue

If(Exists(CheckKey,[Eligible Key]),WCPA,’N/A’) as [WCPA Actual]


Try this:


If(Exists(CheckKey,[Eligible Key]),'WCPA',’N/A’) as [WCPA Actual]

peterkumar
Contributor III
Contributor III
Author

Many thanks Sunny!

Much appreciated.