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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
SimonDB
Contributor III
Contributor III

Search Table Field For A Match In Script

Hi, hope you clever guys out there can give me some advice as I'm really struggling to do the following. I have a table loading in a script and want to do a lookup from one column to another and return the value in a different column if its a match. So to simplify if I have a table that looks like this:

RecNoDescriptionRecordLink
1Apple 
2PearCherry
3Banana 
5Orange 
6BerryApple
7PlumOrange
8Cherry 

 

I want to look for the value in "RecordLink" to see if matches a value in "Description", if it does return that "RecNo" in a new column like the below:

RecNoDescriptionRecordLinkLink_RecNo
1Apple  
2PearCherry8
3Banana  
5Orange  
6BerryApple1
7PlumOrange5
8Cherry  

 

Thank you in advance, Simon.

Labels (3)
1 Solution

Accepted Solutions
SimonDB
Contributor III
Contributor III
Author

Solved this using LookUp

TEMP:
LOAD * Inline [

RecNo, Description, RecordLink
1, Apple,
2, Pear, Cherry
3, Banana,
5, Orange,
6, Berry, Apple
7, Plum, Orange
8, Cherry,
];

DATA:
LOAD *,
Lookup('RecNo', 'Description', RecordLink, 'TEMP') as Link_RecNo

Resident TEMP;

View solution in original post

1 Reply
SimonDB
Contributor III
Contributor III
Author

Solved this using LookUp

TEMP:
LOAD * Inline [

RecNo, Description, RecordLink
1, Apple,
2, Pear, Cherry
3, Banana,
5, Orange,
6, Berry, Apple
7, Plum, Orange
8, Cherry,
];

DATA:
LOAD *,
Lookup('RecNo', 'Description', RecordLink, 'TEMP') as Link_RecNo

Resident TEMP;