Discussion Board for collaboration related to QlikView App Development.
Mapsalvage:
Mapping Load CLAIM_N0, SALVAGE From e:\SALVAGE.qvd
(qvd) ;
ALL:
Load *,
ApplyMap(' Mapsalvage',CLAIM_NO, null()) as SALVAGE
Resident MC;
DROP TABLE MC;
I have above syntax which is running well. But In MC table there are some times more than one records with the same CLAIM_NO and when the above script is run SALVAGE amount is recorded against all such records duplicating the SALVAGE amount. I want to record salvage amount only against distinct CLAIM_NO. How can restrict such a thing through apply map. Pls help
maybe "mapping load distinct" can help ?
What you say is not clear to me
Sorry, I misunderstood you had duplicates in SALVAGE.qvd.
Can't you load you MC table with distinct values ?
MC table cannot be loaded with distinct value
Hi upali,
Try this:
Mapsalvage:
Mapping Load CLAIM_N0, SALVAGE From e:\SALVAGE.qvd
(qvd) ;
ALL:
Load Distinct CLAIM_NO,
ApplyMap(' Mapsalvage',CLAIM_NO, null()) as SALVAGE
Resident MC;
Regards
KC
see attachment if you want this
Hi,
I just tried the below code but not getting any duplications.
Mapsalvage:
Mapping LOAD * inline [
claim_no,salvage
1,100
2,200
3,300
];
MC:
LOAD * inline [
claim_no
1
1
2
2
3
3
];
Demo:
load
applymap('Mapsalvage',claim_no,'null') as Salvage,
claim_no,
1 as field1
resident MC;
drop table MC;
If possible could you post an example?
Hi,
If you chech your table you will see the duplicate rows. They are not shown in a straight table because all data is the same. But if you add an expression count(claim_no), you will see that there are in fact duplicate rows.
If you want to see them, you will have to add a field that is different for the duplicate rows.
For example add a unique RecNo() to the table.
Demo:
load
applymap('Mapsalvage',claim_no,'null') as Salvage,
claim_no,
1 as field1,
RecNo()
resident MC;
First screenshot : without RecNo, with count
Second screenshot : with RecNo
If you don't want to see the RecNo column, just hide it in the properties - presentation as shown here:
Ok ?
Hi,
instead of integrating your salvage field into your MC table, I would keep the salvage.qvd as seperate table to circumvent the granularity mismatch:
so instead of:
MC:
LOAD * INLINE [
CLAIM_NO, field1, field2
1111, 87587, 98798
2222, 76987, 34354
2222, 46543, 32132
3333, 65765, 32432
];
Mapsalvage:
Mapping LOAD * INLINE [
CLAIM_NO, SALVAGE
1111, 1234
2222, 2345
];
ALL:
LOAD *,
ApplyMap('Mapsalvage',CLAIM_NO, null()) as SALVAGE
Resident MC;
DROP TABLE MC;
rather try like:
MC:
LOAD * INLINE [
CLAIM_NO, field1, field2
1111, 87587, 98798
2222, 76987, 34354
2222, 46543, 32132
3333, 65765, 32432
];
tabSalvage:
LOAD * INLINE [
CLAIM_NO, SALVAGE
1111, 1234
2222, 2345
];
hope this helps
regards
Marco