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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Akina0929
Creator
Creator

how to get second occurrence value from mapping table?

Hi,

    I have a mapping table like following

    mapping load

               short name,long name

                KA,karnataka

                KA,karnataka1

                TN,Tamilnadu

               TN,Tamilnadu1

               AP,Andhra pradesh

               AP,Andhrapradesh1

using applymap I want out put from the mapping table is

long name

karnataka1

Tamilnadu1

Andhrapradesh1

Thanking you,

Anji

Labels (1)
1 Solution

Accepted Solutions
tresB
Champion III
Champion III

Try something like:

Map:

mapping load "short name","long name" where Occurance=2;

Load *, AutoNumber(RecNo(),"short name") as Occurance

Inline [     "short name","long name"

                KA,karnataka

                KA,karnataka1

                TN,Tamilnadu

               TN,Tamilnadu1

               AP,Andhra pradesh

               AP,Andhrapradesh1];

              

Load

  ApplyMap('Map',"name") as Mapped

Inline [

name

KA

TN

AP

]

View solution in original post

2 Replies
tresB
Champion III
Champion III

Try something like:

Map:

mapping load "short name","long name" where Occurance=2;

Load *, AutoNumber(RecNo(),"short name") as Occurance

Inline [     "short name","long name"

                KA,karnataka

                KA,karnataka1

                TN,Tamilnadu

               TN,Tamilnadu1

               AP,Andhra pradesh

               AP,Andhrapradesh1];

              

Load

  ApplyMap('Map',"name") as Mapped

Inline [

name

KA

TN

AP

]

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Keep in mind that a mapping table only stores a single translation value (from the 2nd column) per distinct index value (1st column). There simply are no two values in your mapping table for [short name]=KA.

BTW for every distinct value in the first column, a mapping table only keeps the first translation value loaded ! All subsequent "corrections" to a mapping table entry will be ignored. Only the new values will be added.