Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Why the ApplyMap does not work when concatenation is used?

XY_Map:
mapping load
'$(vComp)'&'-'&FIELD1 as ID,
FIELD1&'-'&FIELD2 as Desc;
select FIELD1, FIELD2 from SQL_TABLE;
Fact:
load
...
applymap('XY_Map', '$(vComp)'&'-'&left(FIELD99,7)) as Desc,
...
select FIELD99 from SQL_FACT_TABLE;
1 Solution

Accepted Solutions
swuehl
MVP
MVP

Hi all,

I just gave the mapping tables a unique name (vComp for example). Seems to work now.

See attached.

Regards,

Stefan

View solution in original post

11 Replies
Not applicable
Author

Have you tried to use the apply map after you have concatenated all of the tables via a resident load?

SunilChauhan
Champion
Champion

apply map reuires two seperate table like beelow

mapping load will hide the mapping table and show the table where you use apply map

tab1:

mapping

load *

from path;

Tab2:

Load

appymap(...)  as a

from  paath

so you can use the mapping load via resident table

it will hide your primary table

tab1:

mapping

load *

from path;

Tab2:

Load

appymap(...)  as a

resident tab1

Sunil Chauhan
SunilChauhan
Champion
Champion

try this

XY_Map:
mapping load
'$(vComp)'&'-'&FIELD1 as ID,
FIELD1&'-'&FIELD2 as Desc;
select FIELD1, FIELD2 from SQL_TABLE;

Fact:

load

...

applymap('XY_Map', $(vComp)&'-'&left(FIELD99,7),desc) as Desc,

...

select FIELD99 from SQL_FACT_TABLE;

Sunil Chauhan
Not applicable
Author

Thanks, but I know that and I have two tables. As opposed to the standard school example I'm trying to concatenate two fileds into one I do not understand why it doesn't work.

Not applicable
Author

Thx. I've tried this but am getting error that such field does not exist: Field not found - <Desc>

Not applicable
Author

I have two tables (XY_Map and Fact) so there is no need for Resident.

Miguel_Angel_Baeyens

Hi,

In your original post, you are using a variable '$(vComp)'. What does this variable store? Have you checked that the variable works fine and that the final table (not using the MAPPING prefix) returns the expected values? Are they numeric or literal? If it's a literal (a string) did you try using the Text() function to enclose the whole expression in both the mapping table and the parameter passed to the ApplyMap() function?

Can you post some sample application so we can check further?

Regards.

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica

swuehl
MVP
MVP

Hi all,

I also can't see any principle problem with using concatenation in mapping table and applymap (see attached sample).

Could you be a bit more precise in telling us what you mean with "not work" (Error message, no results, wrong results,  computer crashes etc)?

Regards,

Stefan

Not applicable
Author

Hi all,

Thanks for ideas. I've used the Stefan's example to give you more details.

Basically, I see now it's not an issue with using concatenated fields it's an issue of using it in For...Next loops or using several pairs of tables like for several companies and changing a variable.

I'm getting incomplete results as I don't get connected ALL key fields from the FACT tables and associating MAP tables for second, third, etc tables. I got it connected only for the first table. Please check the modified example Stefan gave me. Thanks a lot.

Regards

swuehl wrote:

Hi all,

I also can't see any principle problem with using concatenation in mapping table and applymap (see attached sample).

Could you be a bit more precise in telling us what you mean with "not work" (Error message, no results, wrong results,  computer crashes etc)?

Regards,

Stefan