Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
nsnybs21qv
New Contributor II

IF (Exists) statement

Hi:

I have two tables: Table A has project ID and Submitted Item ID. Table B has project ID and Selected Item ID which is a subset of Submitted Item ID. I need to add a "Selected?" column to Table A which indicates if an item is selected from each project ID. I was thinking using "If (exists ([Submitted Item ID],[Selected Item ID],'Y','N')" statement, but it ignores the project ID. Any better solution?

Thanks

Yvonne

Table A:  

Project IDSubmitted Item IDSelected?
123AppleY
123BananaY
123OrangeN
123PearN
456BananaN
456OrangeN
456PearY
456WatermelonY

Table B:  

Project IDSelected Item ID
123Apple
123Banana
456Pear
456Watermelon

Tags (1)
1 Solution

Accepted Solutions
MVP
MVP

Re: IF (Exists) statement

LOAD

     [Project ID] & [Selected Item ID] as TMPSelected

FROM TableB;

LOAD

     [Project ID],

     [Submitted Item ID],

     If(Exists(TMPSelected,  [Project ID] & [Submitted Item ID]), 'Y','N') as [Selected?]

FROM TableA;

1 Reply
MVP
MVP

Re: IF (Exists) statement

LOAD

     [Project ID] & [Selected Item ID] as TMPSelected

FROM TableB;

LOAD

     [Project ID],

     [Submitted Item ID],

     If(Exists(TMPSelected,  [Project ID] & [Submitted Item ID]), 'Y','N') as [Selected?]

FROM TableA;

Community Browser