Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have the following .qvd data loaded into my data model:
ADJ_NAME | CLM_STATUS | COV_CODE |
BOB JONES | CL | GD |
JAMES SMITH | CL | AD |
SANDRA HARVY | CL | AB |
In my data model script I am renaming,
ADJ_NAME as Name,
CLM_STATUS as Status,
COV_CODE as Injury
I would like to rename the data within the table-- CL to Closed, GD to General Liability, etc...
How is this possible?
Perhaps like this:
mapReplace:
MAPPING LOAD * INLINE [
Old, New
CL, Closed
GD, General Liabillity
etc....
];
MyData:
LOAD
ADJ_Name as Name,
ApplyMap('mapReplace',CLM_STATUS) as Status
ApplyMap('mapReplace',COV_CODE) as Injury
FROM
....source_qvd...
;
If a value CL occurs in both CLM_STATUS and COV_CODE, but should be replaced by different values then you need to use two mapping tables instead of only the one in the example code above.
Perhaps like this:
mapReplace:
MAPPING LOAD * INLINE [
Old, New
CL, Closed
GD, General Liabillity
etc....
];
MyData:
LOAD
ADJ_Name as Name,
ApplyMap('mapReplace',CLM_STATUS) as Status
ApplyMap('mapReplace',COV_CODE) as Injury
FROM
....source_qvd...
;
If a value CL occurs in both CLM_STATUS and COV_CODE, but should be replaced by different values then you need to use two mapping tables instead of only the one in the example code above.
Hi,
You can do :
[...]
Pick(Match(CLM_STATUS, 'CL', 'GD'), 'Closed', 'General Liabilit') as Status,
Pick(Match(COV_CODE, 'CL', 'GD'), 'Closed', 'General Liabilit') as Injury,
[...]
OR
_MAP_
MAPPING LOAD * INLINE [
CODE, LABEL
CL, Closed
GD, General Liabilit
];
LOAD
ApplyMap('_MAP_', CLM_STATUS) as Status,
ApplyMap('_MAP_', COV_CODE) as Injury,
[...]
Hi,
You can do this by using applymap function
Create 2 mapping loads for status and injury
Status:
Mapping Load * Inline [
Status,Description
CL,Closed
];
COVCode:
Mapping Load * Inline [
COVCode,Description
GD,General Liability
AD ,ADDescription
AB,ABdescription
];
Table:
LOAD ADJ_NAME AS Name,
ApplyMap('Status',CLM_STATUS,'Unknown') AS Status,
ApplyMap('COVCode',COV_CODE,'Unknown') AS Injury
FROM
[https://community.qlik.com/thread/220240]
(html, codepage is 1252, embedded labels, table is @1);
Hi,
I have not used Pick(Match( before. What is the difference int he Apply Map and the Pick Match?
Pick(Match(Field, 'Val1', 'Val2'), 'Value1', 'Value2'))
is like a
If(Field = 'Val1', 'Value1', If(Field = 'Val2', Value2))
In your case the mapping load/ applymap is better (performance and maintenance)