Question

Need assistance referencing the most recent date in a multi value token (when adding to it in Date Token Calculator)

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!

0 0

replied on March 17

To get the very last value in a multi-value token, you can use the Token Dialog, and then Apply Index: the value at index 1 from the end.

0 0
replied on March 17

Here's a quick Workflow I put together to test it out:

The end result looks like this:

```1	3/17/2023	3/16/2024
2	3/17/2024	3/16/2025
3	3/17/2025	3/16/2026
4	3/17/2026	3/16/2027
5	3/17/2027	3/16/2028```

The workflow is attached - you just need to change the file extension back from txt to wfx in order to be able to import it to Workflow.

example.txt (23.14 KB)
2 0
replied on March 17

I got an error when attempting to import.  This seems like EXACTLY what I need!  Any thoughts as to what I can to do avoid the import error?

0 0
replied on March 17

I was able to recreate the WF without importing it.  Thank you so much for your assistance!  I completely forgot about the apply value at index feature!

0 0
replied on March 17

I dunno about that error - maybe Workflow version differences if you are on an older version.  But I'm glad you were able to get it working without importing the example.

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.