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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to replace all fileds with their corresponding keys

I have these two tables:

Table1:

1.png

Table2:

2.png

I want to replace all of the YearEvents and YearEventKey_Grouping with their corresponding key... so for example replace all 2009 WTS with a 1. all 2011 WTS with a 2... etc.

Thanks!

1 Solution

Accepted Solutions
simenkg
Specialist
Specialist

I'm not sure I understand your problem exactly, but if you want to make the YearEventKey_Grouping go from

2009 Submission-2010 Submission to 12-13, then this is how you can do it.

YearEventIDMap:

mapping load

YearEvent,

id

From Table2; //If this table is in memory, then you should use Resident Table2; in stead of From.

Table1:

load

mapsubstring('YearEventIDMap',YearEventKey_Grouping) as YearEventKey_Grouping,

Volume,

ProductA,

ProductB

From Table1; //need to replace this line with the source for table 1.

Hope this helps


Regards
SKG

View solution in original post

2 Replies
simenkg
Specialist
Specialist

I'm not sure I understand your problem exactly, but if you want to make the YearEventKey_Grouping go from

2009 Submission-2010 Submission to 12-13, then this is how you can do it.

YearEventIDMap:

mapping load

YearEvent,

id

From Table2; //If this table is in memory, then you should use Resident Table2; in stead of From.

Table1:

load

mapsubstring('YearEventIDMap',YearEventKey_Grouping) as YearEventKey_Grouping,

Volume,

ProductA,

ProductB

From Table1; //need to replace this line with the source for table 1.

Hope this helps


Regards
SKG

Not applicable
Author

Perfect. Thank you