Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I've the data in my qvd file like this..
| A | B | C |
| 1 | 2 | 1 |
| 2 | 2 | 1 |
| 3 | 2 | 1 |
| 4 | 2 | 1 |
| 1 | 1 | 1 |
| 2 | 1 | 1 |
| 3 | 1 | 1 |
| 4 | 1 | 1 |
Using Mapping concept i want to generate the data as shown below how can i generate it.
| A | B | C | ABCD |
| 1 | 2 | 1 | 8 |
| 2 | 2 | 1 | 6 |
| 3 | 2 | 1 | 4 |
| 4 | 2 | 1 | 2 |
| 1 | 1 | 1 | 7 |
| 2 | 1 | 1 | 5 |
| 3 | 1 | 1 | 3 |
| 4 | 1 | 1 | 1 |
What is the code for this concept?
I got the solution for this..
Temp:
Load * Inline [
A,B,C,ABCD
'1','2','1','8'
'2','2','1','6'
'3','2','1','4'
'4','2','1','2'
'1','1','1','7'
'2','1','1','5'
'3','1','1','3'
'4','1','1','1'
];
Map1:
Mapping
LOAD
A & B & C as key,
ABCD
Resident Temp;
DROP Table Temp;
T2:
LOAD
A,
B, C,ApplyMap('Map1',A & B & C,Null()) as ABCD
FROM
QVD\TFile.qvd
(qvd);
Can you explain the logic behind this tables?
Hello Jacq,
first step mapping table
Mappingtab:
mapping load
A&B&C as Key,
D from source;
then in the second table
load *,
applymap('Mappingtab',A&B&C,0) as ABCD
from source;
Regards
If you observe the first table for each combination i'm assigning one value in second table.
For eg:
The data of the columns A,B,C -> ABCD
1,2,1 ->8
2,2,1 ->6
3,2,1 ->4
4,2,1 ->2
.
.
.
I got the solution for this..
Temp:
Load * Inline [
A,B,C,ABCD
'1','2','1','8'
'2','2','1','6'
'3','2','1','4'
'4','2','1','2'
'1','1','1','7'
'2','1','1','5'
'3','1','1','3'
'4','1','1','1'
];
Map1:
Mapping
LOAD
A & B & C as key,
ABCD
Resident Temp;
DROP Table Temp;
T2:
LOAD
A,
B, C,ApplyMap('Map1',A & B & C,Null()) as ABCD
FROM
QVD\TFile.qvd
(qvd);