TEST!
To-do -
- [ ] Identify whether PPD is this month or last month
- [ ] All premium dates are actually paid 1 month later - so 1 month has to be added to premium dates
- [ ] Calculate the no. of days pending to payment of premium based on [PPD+1M] or [Next PPD+1M]
- [ ] Get the lowest value of the days duration, however ensure value is not less than 0.
Logic -
- First, we parse the year such that it takes CURRENT year.
- Then we use parseDate to join the YYYY-MM-DD.
- Then we calculate the difference between PPD+1M and Today
- Same way we calculate difference between Next PPD+1M and Today
- To ensure neither of these values are negative, we take the max of these or 0.
- Then we take the minimum value of these 2 values - to see which is nearer to today and is not already gone past.
if(prop("Status") == "Active",
lets(
year,
now().formatDate("YYYY"),
premium,
prop("PPD").formatDate("MM-DD"),
nextpremium,
prop("Next PPD").formatDate("MM-DD"),
premiumdate,
parseDate(join([year,premium],"-")),
nextpremiumdate,
parseDate(join([year,nextpremium],"-")),
max(
max(dateBetween(dateAdd(premiumdate,1,"months"),now(),"days"),0),
max(dateBetween(dateAdd(nextpremiumdate,1,"months"),now(),"days"),0)
)
),
"Matured"
)
Sample database below -
Sample policies
Published by @Mayank Agarwal | Mail me here