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

replacing value from table "like vlookup in excel"

Hello

I have a table with region year and labors like this

  

RegionYearlabors
AP-GCSS-DA20155215
EMEA-GCSS-DA20155833
LAR-GCSS-DA20152940
NA-GCSS-DA20153797
AP-GCSS-DA20143319
EMEA-GCSS-DA20142564
LAR-GCSS-DA20141285
NA-GCSS-DA20144880
AP-GCSS-DA20131435
EMEA-GCSS-DA20134173
LAR-GCSS-DA20135552
NA-GCSS-DA20135720
AP-GCSS-DA20124754
EMEA-GCSS-DA20123678
LAR-GCSS-DA20123267
NA-GCSS-DA20123100
AP-GCSS-DA20115052
EMEA-GCSS-DA20111794
LAR-GCSS-DA20111697
NA-GCSS-DA20113607

the proble that I would like to see in qlikview instead of

AP-GCSS-DA ==> APJ

EMEA-GCSS-DA ==> EMEA

LAR-GCSS-DA ==> LAR

NA-GCSS-DA ==> NA


How I can do it from the import?


thanks


Franck

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

SQL doesn't understand QV functions, including applymap.  The fix is simple, use preceding load:

Data:

LOAD

  region As OriginalRegion,

  ApplyMap('MapRegions', region) As Region

...

;

SQL SELECT region ...

from

View solution in original post

5 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

If you want to include only the text up to the first dash, load like this:

     SubField(Region, '-', 1) As Region

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
jonathandienst
Partner - Champion III
Partner - Champion III

If you need a more complex mapping, then use ApplyMap (which the nearest QV equivalent to vlookup):

MapRegions:

Mapping LOAD *

Inline

[

  Region, Region2

  AP-GCSS-DA, APJ

  EMEA-GCSS-DA, EMEA

  LAR-GCSS-DA, LAR

  NA-GCSS-DA, NA

  ...

];

Data:

LOAD ....

  Region As OriginalRegion,

  ApplyMap('MapRegions', Region) As Region

  ....

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

thanks

In this simple example it's working fine.

but I am trying to insert this code in another file where I have

SQL SELECT region ...

from

it's not working there!!

I believe that the problem is with the SQL select

Do you have an idea how I can implement your code.

I would like to keep my original SQL select.

thanks

Anonymous
Not applicable
Author

SQL doesn't understand QV functions, including applymap.  The fix is simple, use preceding load:

Data:

LOAD

  region As OriginalRegion,

  ApplyMap('MapRegions', region) As Region

...

;

SQL SELECT region ...

from

Not applicable
Author

Hi

it's working fine

thanks