I have two multi-value tokens that are dates, and I am trying to retrieve the most recent (highest) date from that token and then use the date token calculator to add a year to it and write the new value back to the multi-value token. I need to cycle through that process for a number of times specified by the value of a variable retrieved from a business process. I'm drawing a blank as to how to obtain the most recent date so that I can use that in the Date Token Calculator activity and add a year to it.
Backstory: I am using data provided about a lease from a LF Form that provides the start and end dates of the lease and the lease term in years. This workflow then needs to create the appropriate start and end dates for each year of the lease term and fill that information in a table in another LF Form so that the user can input the rent amounts for each lease year. Let's say the lease is for 5 years. I am having WF write the lease start date as the first date in the RentStartDate token. I then have WF calculate the rent end date for the first year by taking the lease start date, adding 1 year and deducting 1 day. That value is written as the first value in the RentEndDate token. Now I need to go back 4 more times and add 1 year to the previous value of the highest RentStartDate token value (and do the same to the RentEndDate token value). Of course the 4 is pulled from a variable so it will change for each lease that is encountered.
Any ideas as to how to achieve this would be greatly appreciated!