Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
Highlighted
New Contributor II

ERROR: Applymap with map_id as expression

Version:12.20.20200.0 Nov2017 SR1

Error: ApplyMap error:map_id not found

MAP_C1:

Mapping LOAD * INLINE [

    Heading1, Heading2

    Row1, 123

    Row1, 321

];

MAP_C2:

Mapping LOAD * INLINE [

    Heading1, Heading2

    Row1, abc

    Row2, cba

];

MAP_OUT:

Load

applymap('MAP_'&Security_ID,'Row1','no map') as MAP_Result,

Security_ID

;

LOAD * INLINE [

    Security_ID

    C1

    C2

];

1 Solution

Accepted Solutions
MVP
MVP

Re: ERROR: Applymap with map_id as expression

You could make a single mapping table and do this to achieve the same:

MAP_C:

Mapping LOAD * INLINE [

    Heading1, Heading2

    C1|Row1, 123

    C1|Row2, 321

    C2|Row1, abc

    C2|Row2, cba

    ];


MAP_OUT:

Load

ApplyMap( 'MAP_C' , Security_ID & '|' & 'Row1' , 'no map' ) AS MAP_Result,

Security_ID

;


LOAD * INLINE [

    Security_ID

    C1

    C2

];

View solution in original post

5 Replies
Highlighted
Contributor III

Re: ERROR: Applymap with map_id as expression

Try below code

MAP_C1:

Mapping LOAD * INLINE [

    Heading1, Heading2

    Row1, 123

    Row1, 321

    ];

MAP_C2:

Mapping LOAD * INLINE [

    Heading1, Heading2

    Row1, abc

    Row2, cba

    ];

   

MAP_OUT:

Load

applymap('MAP_C1'&Security_ID,'Row1','no map') as MAP_Result,

Security_ID

;

LOAD * INLINE [

    Security_ID

    C1

    C2

];

Highlighted
MVP
MVP

Re: ERROR: Applymap with map_id as expression

The ApplyMap()-function does not allow for an expression as the mapping table name - the first parameter. It has to be a constant string.

So you could change your code to this to get it to work:

Pick( Match( Security_ID , 'C1' , 'C2')

  ,ApplyMap( 'MAP_C1 ', 'Row1' , 'no map' )

  ,ApplyMap( MAP_C2' , 'Row1' , 'no map' )

) AS MAP_Result,

MVP
MVP

Re: ERROR: Applymap with map_id as expression

You could make a single mapping table and do this to achieve the same:

MAP_C:

Mapping LOAD * INLINE [

    Heading1, Heading2

    C1|Row1, 123

    C1|Row2, 321

    C2|Row1, abc

    C2|Row2, cba

    ];


MAP_OUT:

Load

ApplyMap( 'MAP_C' , Security_ID & '|' & 'Row1' , 'no map' ) AS MAP_Result,

Security_ID

;


LOAD * INLINE [

    Security_ID

    C1

    C2

];

View solution in original post

Highlighted
New Contributor II

Re: ERROR: Applymap with map_id as expression

Thank you, your solution is nice and elegant!

Creating two mapping tables did seem unnecessary.

I thought map_ids as expressions used to work. Was it removed recently?

Highlighted
MVP
MVP

Re: ERROR: Applymap with map_id as expression

I don't know - I never tried to make it as an expression before.