Qlik Community

Ask a Question

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Talk to Experts Tuesday, January 26th at 10AM EST: Qlik Sense. REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Creator II
Creator II

Apply map

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

1 Solution

Accepted Solutions
MVP
MVP

see attachment if you want this

1.png

View solution in original post

10 Replies
Creator
Creator

maybe "mapping load distinct" can help ?

Creator II
Creator II

What you say is not clear to me

Creator
Creator

Sorry, I misunderstood you had duplicates in SALVAGE.qvd.

Can't you load you MC table with distinct values ?

Creator II
Creator II

MC table cannot be loaded with distinct value

Master II
Master II

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

Best Regards,
KC
MVP
MVP

see attachment if you want this

1.png

View solution in original post

Not applicable

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?

Creator
Creator

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

reco.png

If you don't want to see the RecNo column, just hide it in the properties - presentation as shown here:

reco2.png

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;

QlikCommunity_Thread_136033_Pic1.JPG.jpg

QlikCommunity_Thread_136033_Pic3.JPG.jpg

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

];

QlikCommunity_Thread_136033_Pic2.JPG.jpg

QlikCommunity_Thread_136033_Pic4.JPG.jpg

hope this helps

regards

Marco