Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
sspawar88
Creator II
Creator II

Applymap Max Date for Mapping Tables


Hi Community,

I'm trying to solve following problem where through one mapping Table TIMEPQ we have taken dates into A, B, C table

In A table

1) we are fetching all dates from TIMEPQ through applymap. thats ok

In B & C

1) We want data only for Max of Process date throughout all fileds in both tables.

2) Between B&C there is Concatation

 

TIMEPQ:

MAPPING LOAD
DQ_TIME_ID,
Date(BUSINESS_DATE,'MM/DD/YYYY')as BUSINESS_DATE
FROM C:\Users\TIMEPQ.qvd(qvd);

A:
LOAD
DQ_TIME_ID AS DQ_TIME_ID1,
ApplyMap('TIMEPQ',DQ_TIME_ID,Null()) as LOAD_DATE,
CHECK_POINT_ID,
ROW_CNT
FROM C:\Users\A.qvd(qvd);

 

B:
LOAD 
CHECK_POINT_ID,
DQ_TIME_ID,
RowNo() as rowno,
RecNo() as recno,
ApplyMap('TIMEPQ',DQ_TIME_ID) as [Process Date],
EXCEPTION_DETAIL_1,
EXCEPTION_DETAIL_2
FROM C:\Users\B.qvd(qvd); 

Concatenate(B)

C:

LOAD 
CHECK_POINT_ID, 
DQ_TIME_ID,
ApplyMap('TIMEPQ',DQ_TIME_ID) as [Process Date],
EXCEPTION_QTY,
TOTAL_ROW_QTY

FROM C:\Users\C.qvd(qvd);

 

3 Replies
its_anandrjs

Dear Satish,

Try this ways for table B and C take new mapping table with only max date as you required and map this table dates with B and C.

TIMEPQ:
MAPPING LOAD
DQ_TIME_ID,
Date(BUSINESS_DATE,'MM/DD/YYYY') as BUSINESS_DATE
FROM C:\Users\TIMEPQ.qvd(qvd);

//Max Date Table
MAXTIMEPQ:
MAPPING LOAD
DQ_TIME_ID,
Date( Max(BUSINESS_DATE) ,'MM/DD/YYYY') as BUSINESS_DATE
FROM C:\Users\TIMEPQ.qvd(qvd)
Group By DQ_TIME_ID
;

A:
LOAD
DQ_TIME_ID AS DQ_TIME_ID1,
ApplyMap('TIMEPQ',DQ_TIME_ID,Null()) as LOAD_DATE,
CHECK_POINT_ID,
ROW_CNT
FROM C:\Users\A.qvd(qvd);


B:
LOAD
CHECK_POINT_ID,
DQ_TIME_ID,
RowNo() as rowno,
RecNo() as recno,
ApplyMap('MAXTIMEPQ',DQ_TIME_ID) as [Process Date],
EXCEPTION_DETAIL_1,
EXCEPTION_DETAIL_2
FROM C:\Users\B.qvd(qvd);

Concatenate(B)
C:
LOAD
CHECK_POINT_ID,
DQ_TIME_ID,
ApplyMap('MAXTIMEPQ',DQ_TIME_ID) as [Process Date],
EXCEPTION_QTY,
TOTAL_ROW_QTY
FROM C:\Users\C.qvd(qvd);

Regards,

Anand

Anil_Babu_Samineni

Try to append this script to your existing one

I mean this

A:

Load * From <>;

B:

Load * From <>;

Concatenate(B)

C:

Load * From <>;

Left Join(B)

Load Max([Process Date]) as OnlyMaxDate

Resident B

Group By Allpossibledimensions;

Inner Join(C)

Load *

Resident C;

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sspawar88
Creator II
Creator II
Author

Hi Anannd,

A table needs all dates from TIMEPQ table.

If we Just fetch Max dates it will fetch only MAX Date