
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Applymap on multiple columns
Hello,
I have this table as mapping
map:
LOAD * INLINE [
lookup, substitute
-, 0
+, 1
];
and this table with data
Accepted Solutions


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's possible with a mapping but without loop-stuff or applymap() else applying the mapping on a global level against the system-tables. Here an example how it might be done:
m: mapping load * inline [
L, R
-, 0
+, 1
];
map F1, F2, F3 using m;
t: load * inline [
K, F1, F2, F3
1, -, -, +
2, +, -, -
3, -, -, -
4, +, +, +
];
But IMO it's not the best approach with your data because they have no normal record-structure else they are a crosstable. This kind of data-structure has so many disadvantages that's seldom sensible to keep them else it would be better to transform them per: The Crosstable Load - Qlik Community - 1468083 and on the remaining value-column you could use the applymap().


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your table "map" only becomes an actual mapping table if you add the prefix "mapping", otherwise it's just a regular table. LIke so:
map:
MAPPING LOAD * INLINE [
lookup, substitute
-, 0
+, 1
];
That table will not be visible in the data model, and it will be dropped after script execution.
Mapping tables are used in combination with applymap() function. Read up on mapping tables and the applymap function, and you'll find you will not have to loop over the table.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You have right with prefix "Mapping" but even after i read specification of applymap() I have no clue how to use this without loop or sub. Of coures I can use applymap() on every column separate and it will work for sure.
But naming of theese columns changing very often with each release of "Line up" table and I try to build script which will be indestructible forever.
Bellow is my script but i still have some issue with calling sub for columns in variable


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's possible with a mapping but without loop-stuff or applymap() else applying the mapping on a global level against the system-tables. Here an example how it might be done:
m: mapping load * inline [
L, R
-, 0
+, 1
];
map F1, F2, F3 using m;
t: load * inline [
K, F1, F2, F3
1, -, -, +
2, +, -, -
3, -, -, -
4, +, +, +
];
But IMO it's not the best approach with your data because they have no normal record-structure else they are a crosstable. This kind of data-structure has so many disadvantages that's seldom sensible to keep them else it would be better to transform them per: The Crosstable Load - Qlik Community - 1468083 and on the remaining value-column you could use the applymap().

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is such a simple approach I did not think about this in that way. Extremely useful in that case!🤑
But I have another question regarding this.
Once I do crossable and applymap(). Is there a way to return to initial format and pivot table back?😇
I love to use this method in power query-based tools.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The reverse way and pivoting data is also possible per The Generic Load - Qlik Community - 1473470 whereby it has one step more (joining within a loop) if really a complete table should be returned - otherwise each attribute would have an own table.
Better is usually just to use a pivot-chart within the UI and applying the created category-dimensions (means I would add at least one upper-categorize) horizontally.
