Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
ecems
Contributor II
Contributor II

Search a list in a column

Hi everyone;

I have a firm list (Column name: FIRM) and I load it to qlik; and i have another SQL query and i want to search this list in a column of this query (Column name: CAMPAIGN).

I tried different solutions but it they didnt work. Can you help me?

Thanks!

=IF( WILDMATCH (CAMPAIGN, FIRM), 1, 0)

=IF( LIKE (CAMPAIGN, FIRM), 1, 0)

=IF( LIKE (CAMPAIGN, '$FIRM'), 1, 0)

=IF( LIKE (CAMPAIGN, '*'$FIRM'*'), 1, 0)

Labels (4)
8 Replies
vinieme12
Champion III
Champion III

are the fields CAMPAIGN and FIRM in the SAME TABLE?

 

can you post some sample data and expected output so its easier to understand what you are trying to achieve

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi, If you do this during load you could:

  • Create map like

map_Campaign:

Mapping Load Distinct

FIRM,1

From (your SQL query...);

  • Then apply map when loading FIRM

Load

CAMPAIGN,

ApplyMap('map_Campaign',CAMPAIGN,0) as flag_match

From (your source of SQL query);

 

 

If you want to do this in UI first you need to convert your list of firms into array (you can use Concat() function to do this.

cheers

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
ecems
Contributor II
Contributor II
Author

Thanks for  your reply, no they are not in the same table.

 

Fe:

FIRM LIST TABLE:

FIRM

  • A
  • B

 

CAMPAIGN INFO TABLE:

CAMPAIGN

  • A CAMPAGIN
  • FIRM A CAMPAIGN
  • A
  • FIRM A
  • B
  • FIRM B CAMPAIGN

I WANT THIS RESULT:

  • A CAMPAGIN
match with campaing
  • FIRM A CAMPAIGN
match with campaing
  • A
match with campaing
  • FIRM A
match with campaing
  • B
match with campaing
  • YXT
no match
  • FIRM X
no match

 

vinieme12
Champion III
Champion III

as below

CheckFirm:
Mapping load FIRM,'@EXISTS@' as Sub INLINE [
FIRM
A
B
C
D
];

load *,if(Index(MapSubString('CheckFirm',CAMPAIGN),'@EXISTS@'),'matching','no match') as Match Inline [
CAMPAIGN
A CAMPAGIN
FIRM A CAMPAIGN
A
FIRM A
B
FIRM B CAMPAIGN
YXT
FIRM X
];

 

vinieme12_0-1676884687029.png

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
ecems
Contributor II
Contributor II
Author

Should I write it load editor?

vinieme12
Champion III
Champion III

Yes, this must be in LOAD SCRIPT 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
ecems
Contributor II
Contributor II
Author

Thanks a lot, i have a little problem; i dont want to write campaign names; i want to use a column of a table  (column name is CAMPAIGN NAME)

 

as Match Inline [
CAMPAIGN
A CAMPAGIN
FIRM A CAMPAIGN
A
FIRM A
B
FIRM B CAMPAIGN
YXT
FIRM X
];

 

vinieme12
Champion III
Champion III

This would be as below

Consider C

ampaignTable has field CAMPAIGN NAME

and FirmTable has field FIRM NAME

__________________________

 

FirmTable:

Load [FIRM_NAME],dim1,dim2,otherfield1,otherfield2

From FirmTableSource;

 

CheckFirm:

Mapping Load Distinct FIRM_NAME ,'@EXISTS@' as Sub

Resident FirmTable;

 

CampaignTable:

Load [CAMPAIGNNAME],dim1,dim2,otherfield1,otherfield2

,if(Index(MapSubString('CheckFirm',CAMPAIGN),'@EXISTS@'),'matching','no match') as Match

From CampaignTableSource;

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.