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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to select values from two columns to one output column

hi friend,

I have database table with following structure and data:
colX colY colZ
1 A B
2 A C
3 A D
4 A B
5 B A
6 B C
7 B D
8 B E
9 C B
10 C D
11 C E
12 D B
13 D A
14 E B
15 A E
16 D B
17 C B
18 C A
19 C B
20 B C
and I would want output in next form:
colX colQ
1 A
2 A
3 A
4 A
5 A
13 A
15 A
18 A
means to select all rows where colY="A" or colZ="A" and display value "A" in new column "Q"

How can I create load in script with that functionality in QlikView???

Then I want put table object with fields "colX", "colQ".

3 Replies
Miguel_Angel_Baeyens

Hello,

I'd do something like the following in the load script

If(colY = 'A' OR colZ = 'A', colX) AS colXShow, // this one to be displayed in your table


Hope that helps

Not applicable
Author

sorry, I don't understand, how ...

this "IF" command I can put to script? Or put it to QlikView object (Table Box)?

Please send me more info, or more example.

but however, very thanks

Miguel_Angel_Baeyens

This is created in the script. It will perform better than in the object

Table:LOAD colX, colY, colZ, If(colY = 'A' OR colZ = 'A', colX) AS colXShowFROM table.qvd (qvd); // Or the source you are getting the records from


Regards