Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
buc_christian
New Contributor III

Search for equal field in other column

Hallo Community,

i have a Scripting Problem and am searching for help.

my data structure looks like that:

Column A, Column B, Column C

1, 0, 99

2, 1, 999

3, 4, 9

4, 6, 9999

5, 2, 99999

within the script I want to:

Load

Column A,

"search for value in of column A in column B and return the value of column C" as Value

From xxx;

The Table in my App should look like:

Column A, Value

1, 999

2, 99999

3,

4,

5,

Thanks for any help in advance!!

Chris

1 Solution

Accepted Solutions
mov
Esteemed Contributor III

Re: Search for equal field in other column

Chris, I'd do it by mapping.  First, create map:

Mapping:
MAPPING LOAD DISTINCT
B,
C
FROM InitialData;

Next, use applymap:


Result:
LOAD
A,
applymap('Mapping', A, null()) as C
FROM InitialData;

6 Replies
mov
Esteemed Contributor III

Re: Search for equal field in other column

Chris, I'd do it by mapping.  First, create map:

Mapping:
MAPPING LOAD DISTINCT
B,
C
FROM InitialData;

Next, use applymap:


Result:
LOAD
A,
applymap('Mapping', A, null()) as C
FROM InitialData;

oscarmqz
Contributor III

Re: Search for equal field in other column

MapTable:

Mapping Load  B as A,C From xxx;


LOAD A, ApplyMap('MapTable', A, null()) as C
          From xxx;


Renaming B to A to have same column name, that's how mapping load works. ID column to match and the column to be retrieved

null() is the value to assign if there's no match

Not applicable

Re: Search for equal field in other column

Mapping load doesn't really care about field names. The first field is searched and the second one is the result.

oscarmqz
Contributor III

Re: Search for equal field in other column

oh I see, thanks for the clarification, regards!

buc_christian
New Contributor III

Re: Search for equal field in other column

hey guys, that sounds as a good idea, i try it out and then i ll give Feedback, hope it works,

thank you in advance

buc_christian
New Contributor III

Re: Search for equal field in other column

Thanks to all. Solution works. Since i want to map more than one column in my original file, i do it with a join... works very well!!!

Ty all, again.

Community Browser