Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Wildcard when ApplyMap

Hi!

I'm mapping serial numbers to a description and I just wonder if there are any way to create a sequence with a wildcard?

Six digits and the seventh is 0-9.

This is what I have now:

mytable:

Mapping LOAD * INLINE [

QLKRTP, QLDESC_OWN

4263870,Lorem ipsum

4263871,Lorem ipsum

4263872,Lorem ipsum

4263873,Lorem ipsum

4263874,Lorem ipsum

4263875,Lorem ipsum

4263876,Lorem ipsum

4263877,Lorem ipsum

4263878,Lorem ipsum

4263879,Lorem ipsum

4263880,Dolor sit amet

4263881,Dolor sit amet

4263882,Dolor sit amet

4263883,Dolor sit amet

4263884,Dolor sit amet

4263885,Dolor sit amet

4263886,Dolor sit amet

4263887,Dolor sit amet

4263888,Dolor sit amet

4263889,Dolor sit amet

];


But I want:

mytable:

Mapping LOAD * INLINE [

QLKRTP, QLDESC_OWN

426387*,Lorem ipsum

426388*,Dolor sit amet

];

Possible?

regd

thomas

6 Replies
MVP
MVP

Wildcard when ApplyMap

Define your map table like

mytable:
Mapping LOAD * INLINE [
QLKRTP, QLDESC_OWN
426387,Lorem ipsum
426388,Dolor sit amet
];

and then use

applymap('mytable', left(FIELD,6) )


in your load

Not applicable

Wildcard when ApplyMap

Hi!

Need

applymap('mytable', left(FIELD,7) ) and that's why I need 0-9 on every possible 6-digit number.

Sometimes , when certain conditions is met, I need to do a deeper investigation and look in a different mapping table.

rgds

thomas

Highlighted
MVP
MVP

Wildcard when ApplyMap

Thomas,

I understood that you have a field with a 7 digit number, but only the first 6 are significant for your lookup.

So I suggest that you look only at your first 6 digits and look those up in your mapping table.

I quite don't understand when you are saying:

Need applymap('mytable', left(FIELD,7) ) and that's why I need 0-9 on every possible 6-digit number.

or why my suggestion should not solve your problem. Could you maybe give an example where my suggested code doesn't give you the expected result?

Re: Wildcard when ApplyMap

It looks to me like Stefan's suggestion works in this case. However, if you need full wildcard mapping, see the QV Cookbook (http://robwunderlich.com/downloads/)  example "Mapping with a table using wildcards" or easier still use the Qlikview Components (http://qlikviewcomponents.org) function "Qvc.CreateWildMapExpression".

-Rob

Not applicable

Re: Wildcard when ApplyMap

If I understand you maybe this can help you:

map_table:

Mapping

LOAD  '|' & QLKRTP as QLKRTP_Map, QLDESC_OWN as QLDESC_OWN_Map INLINE [

QLKRTP, QLDESC_OWN

426387,Lorem ipsum

426388,Dolor sit amet

];

DATA:

LOAD purgechar(mapsubstring('map_table','|' & ID),'0123456789') as MappedField, * INLINE [

ID, VALUE

426387023432,TypeA

426387123232,TypeA

426387229564,TypeA

426388102932,TypeB

426388923983,TypeB

];

Regards

Not applicable

Re: Wildcard when ApplyMap

Hi Rob,

Is this solution (createwildmap OR the Cookbook - they appear to be the same thing as per the script) working in QV11?

I get an error on the first line, seems like there's something missing. I tried removing the ( ' ) before 'pick' but that leads to many more syntax checks.

Can you please guide. Appreciate all your help.

-Chirag

Untitled.png