Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to Exclude values in a script

I wrote a script that create the table below

LocationDate
Bateen26/2/2013
Bateen27/2/2013
Khazna27/2/2013
khaleej28/2/2013

Now i created another script that show another table which also have location and date along with i  other answer

What i want to do in this table is to have only the raws which match the able above

so if a raw contain Bateen and 28/2/2013  which are not in the above table then this automatically ignored and removed

1 Solution

Accepted Solutions
Gysbert_Wassenaar

You can use a left keep:

Table1:

Load * From Source1;

left keep (Table1)

Table2:

Load * From Source2;


talk is cheap, supply exceeds demand

View solution in original post

5 Replies
its_anandrjs

Write like

Tab1:

Load Location&'|'&Date as Key

Load * inline

[

Location,Date

Khazna,27/2/2013

khaleej,28/2/2013

Bateen,26/2/2013

Batten,27/2/2013

];

left join

Tab2:

Load

Location&'|'&Date as Key,

Location, Date

from Location;

In this only upper table records is added

Hope this helps

Gysbert_Wassenaar

You can use a left keep:

Table1:

Load * From Source1;

left keep (Table1)

Table2:

Load * From Source2;


talk is cheap, supply exceeds demand
maxgro
MVP
MVP

another one

First:

LOAD Location,

    Date,

    Location & '-' & Date as LocAndDate

FROM

[http://community.qlik.com/thread/112589]

(html, codepage is 1252, embedded labels, table is @1);

Second:

load *

Where exists(LocAndDate, Location2 & '-' & Date2);

load * inline [

Location2, Date2

Bateen, 26/2/2013

Bateen, 27/2/2013

Khazna, 27/2/2013

khaleej,28/2/2013

Bateen, 26/2/2014

Bateen, 27/2/2014

Khazna, 27/2/2014

khaleej,28/2/2014

Paris,26/2/2013

]

;

DROP Field LocAndDate;

Not applicable
Author

Create a key using Laocation and Date. I would suggest converting the Date to number using num() in the key. Thi is to make sure that the dates are matched properly, though it may have different formats in the second table.

Use "Where exists" to filter out the unwanted records.

Tab1:

Load Location&'|'& num(Date) as Key

Load * inline

[

Location,Date

Khazna,27/2/2013

khaleej,28/2/2013

Bateen,26/2/2013

Batten,27/2/2013

];


Tab2:

load *

FROM [....]  //Actual path here

Where exists(Key, Location & '|' &num( Date));

Drop table Tab1:

Not applicable
Author

This is helpful but i think actuall tab2 should be referred first as its the tab that should be reduced