I have two input files one is source and another is target
Source:
| Contract_Number | Contract_Item_Number | Product_Code | Annualized_Value | Contract_start_date | Contract_end_date |
| 30515758 | 500 | 2000014273 | 5209.09 | 2026-06-08 | 2027-06-07 |
| 30515758 | 740 | 2000014273 | 4914.23 | 2025-06-08 | 2026-06-07 |
| 30515758 | 500 | 2000014273 | 4592.74 | 2024-06-08 | 2025-06-07 |
Target:
| Contract_Number | Contract_Item_Number | ProductCode__c | AmountPrice__c | AmountPrice2__c | Amount_Price_3__c | Amount_Price_4__c | Amount_Price_5__c | Amount_Price_6__c | Amount_Price_7__c | EndDate__c | AmountAllocatedFinal__c | Year2AmountAllocatedFinal__c | Year3AmountAllocatedFinal__c | Year4AmountAllocatedFinal__c | Year5AmountAllocatedFinal__c | StartDate__c | Year1Amount__c | Year1EndDate__c | Year1StartDate__c | Year2Amount__c | Year2EndDate__c | Year2StartDate__c | Year3Amount__c | Year3EndDate__c | Year3StartDate__c |
| 30515758 | 500 | 2000014273 | 4592.74 | 4914.23 | 5209.09 | | | | | 6/7/2027 | 4592.74 | 4914.23 | 5209.09 | | | 6/8/2024 | 4592.74 | 6/7/2025 | 6/8/2024 | 4914.23 | 6/7/2026 | 6/8/2025 | 5209.09 | 6/7/2027 | 6/8/2026 |
Expected :
1. Above Target line is consolidate from source input based on the Product_Code, Contract_Number,Contract_start_date,Contract_end_date
2. AmountPrice__c -> Mapped from Annualized_Value of First Contract_start_date & Contract_end_date. Similarly applied to other columns like AmountAllocatedFinal__c and Date columns too
Can someone help me to generate one Output file which consolidate this source and Target columns along with the Match & Mismatch for all the above columns.
Note: Another type of source data is when product code is different for Contract Number then no consolidation will be happen. SO we need to handle those as well.