Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
rvc_121985
Contributor III
Contributor III

Nearest Next Date

Hi Team,

Looking for the Script to pick nearest next Date from the list of dates. I have below example to show. in MM/DD/YYYY

Table A: Invoices with Due Dates

Invoice Due date
1234 3/31/2022
5678 1/30/2022
9012 12/20/2022
3456

12/31/2022

 

Table B : Payment Dates

Payment Date
1/31/2022
3/30/2022
4/5/2022
12/30/2022
1/2/2023

 

For each invoices from Table A, I would like to pick next Nearest Payment date from Table B.

Result should appear as below;

Invoice Due date Next Nearest Pmnt Date
1234 3/31/2022 4/5/2022
5678 1/30/2022 1/31/2022
9012 12/20/2022 12/30/2022
3456 12/31/2022 1/2/2023

 

Is there any way to do this in Script ?

Thanks,

 

 

Labels (1)
11 Replies
rvc_121985
Contributor III
Contributor III
Author

@Kushal_Chawda  right If I drop the TableB it's Good.

rvc_121985
Contributor III
Contributor III
Author

@MarcoWedel Some how the result is not correct where the same due date is repeating. or more than 2 due days falling on Payments dates are getting 2 different Nearestduedate

 

Thanks,