Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Pulkit_Thukral
Partner - Creator II
Partner - Creator II

Keyword Searching between 2 Different Tables

Hi All,

i am creating a logic for keyword searching for the below scenario:

i have 2 different excels :

1st excel has Keyword

2nd excel has 'id' written in the description field so we have to do wildmatch for searching.

Example:

1st Excel :

Keyword

ABC

DEF

XYZ

2nd Excel:

Ticket      State      --------      Description

1               new      --------      ORA:ABC-daskjasdas

2               closed   --------      SRV:DEF-sadra

My Output should be joining both the tables based on 1st excel field(left join)

Output:

Keyword        Ticket      State      --------      Description

ABC            1               new      --------      ORA:ABC-daskjasdas

DEF            2               closed   --------      SRV:DEF-sadra

as i found keyword written in description field for these 2 keywords only.

1 Solution

Accepted Solutions
tamilarasu
Champion
Champion

Hi Pulikit,

Try this script.

Temp:

LOAD Keyword

FROM

Book1.xlsx

(ooxml, embedded labels, table is Sheet1);

Join

LOAD [Ticket     ],

     [State     ],

     [--------     ],

     Description

FROM

Book2.xlsx

(ooxml, embedded labels, table is Sheet1);

Noconcatenate

Result:

LOAD *

Resident Temp

where WildMatch(Description, '*' & Keyword & '*');

DROP Table Temp;

View solution in original post

12 Replies
tamilarasu
Champion
Champion

Hi Pulikit,

Try this script.

Temp:

LOAD Keyword

FROM

Book1.xlsx

(ooxml, embedded labels, table is Sheet1);

Join

LOAD [Ticket     ],

     [State     ],

     [--------     ],

     Description

FROM

Book2.xlsx

(ooxml, embedded labels, table is Sheet1);

Noconcatenate

Result:

LOAD *

Resident Temp

where WildMatch(Description, '*' & Keyword & '*');

DROP Table Temp;

MindaugasBacius
Partner - Specialist III
Partner - Specialist III

Description field contains those values, right?

ORA:ABC-daskjasdas

SRV:DEF-sadra


Well I offer you trying few ways for finding the Key:

=mid(trim(Description), 5, 3)

=subfield(replace(trim(Description), '-', ':'), ':', 2)

tresesco
MVP
MVP

If you have small data set, you can go with cross join and then filter using where clause as shown by Tamil above. If you have big volume data, you should avoid the cross join and try like:

Map:

Mapping Load

  Keyword as Keyword1,

  '<'&Keyword&'>' as Keyword

  Inline [

Keyword

ABC

DEF

GHI

];

Table1:

Load *

  Inline [

Keyword

ABC

DEF

GHI

];

Inner join

Table2:

load

  Ticket,

  State,

  Description,

  TextBetween(Mapped,'<','>') as Keyword

Where Mapped<>Description;

Load

  *,

  MapSubString('Map',Description) as Mapped;

mapping Load * Inline [

Ticket, State, Description

1,   new,   ORA:ABC-daskjasdas

2,  closed, SRV:DEF-sadra

];

Kushal_Chawda

T1:

LOAD

Upper(trim(Keyword)) as Keyword

FROM table;

left join(T1)

LOAD

    Ticket,

    State,

    Description,

    Upper(trim(Textbetween(Description,':','-'))) as Keyword

FROM T2;

Pulkit_Thukral
Partner - Creator II
Partner - Creator II
Author

Thanks Tamil.It worked perfectly

Kushal_Chawda

Make sure that you are performing cross join here.. which may cause performance issue if data set increased.

qlikview979
Specialist
Specialist

Hi Nagaraj,

How your Wild match Condition will work ? Please  Explain ?

Regards,

Mahesh.

tamilarasu
Champion
Champion

Hi Mahesh,

If we join the two tables, the result looks like below.

Capture.PNG

In the resident load, we can use wildmatch to load only the matched rows. 

qlikview979
Specialist
Specialist

Hi Nag,

I got It . in your Expression

where WildMatch(Description, '*'& Keyword &'*' );

after Keyword  How it will work "*"

Regards,

Mahesh.