Help

Find next activity date in simple case management system

Topic Labels: Formulas
Solved
Jump to Solution
769 9
cancel
Showing results for 
Search instead for 
Did you mean: 
bitstreams_red
6 - Interface Innovator
6 - Interface Innovator

I have a simple linked table. There is a table of CASES with a bunch of fields and then another table called CASE ACTIVITY which has scheduled activities for each CASE, so the tables are linked by CASEID which is the primary field on CASES.

That all works fine. Under CASE ACTIVITY each row is a dated activity, so :

CASEIDScheduled actionDate
65Sent for review10/10/2024
65Publish findings12/10/2024

I would like to have a formula field in CASES that shows the date when the next activity occurs. And I started with a formula field that simply said "MIN({Date (from Case Activity)})" but it returns a value of zero.

Ultimately it would also need to not pick dates that have already passed.

Any ideas?

1 Solution

Accepted Solutions

Hello,

I assumed that your purpose is to display the next date to come for each case, my apologies if i misunderstood your request.

Here is what i tried.

Table Case Activity

Pascal_Gallais_0-1727949107512.png

Case 1 hase 3 dates, one past and 2 to come

Table Case

Pascal_Gallais_1-1727949182709.png

Field "Next date" diplays the next date to come.

To achieve that, I did the following

Table Case Activity / Numeric date

Pascal_Gallais_2-1727949267637.png

Formula field "number_date" transforms each date into an integer:

Pascal_Gallais_3-1727949333199.png

the "+0" at the end of the formula is to make sure that we do end up with a numeric field type.

Table Case / Formulas

Pascal_Gallais_4-1727949456991.png

Field dates is a rollup on field "number_date" from table "Case activity" with a condition to discard past dates:

Pascal_Gallais_5-1727949545240.png

Field "First_Date" returns the minimum of field "Dates" and transform it into text type:

Pascal_Gallais_6-1727949624353.png

Field "Next date" makes the result look like a date:

Pascal_Gallais_7-1727949692411.png

Note that this field is a text type field, not a calendar type.

Regards,

Pascal

See Solution in Thread

9 Replies 9

Hello,

I assumed that your purpose is to display the next date to come for each case, my apologies if i misunderstood your request.

Here is what i tried.

Table Case Activity

Pascal_Gallais_0-1727949107512.png

Case 1 hase 3 dates, one past and 2 to come

Table Case

Pascal_Gallais_1-1727949182709.png

Field "Next date" diplays the next date to come.

To achieve that, I did the following

Table Case Activity / Numeric date

Pascal_Gallais_2-1727949267637.png

Formula field "number_date" transforms each date into an integer:

Pascal_Gallais_3-1727949333199.png

the "+0" at the end of the formula is to make sure that we do end up with a numeric field type.

Table Case / Formulas

Pascal_Gallais_4-1727949456991.png

Field dates is a rollup on field "number_date" from table "Case activity" with a condition to discard past dates:

Pascal_Gallais_5-1727949545240.png

Field "First_Date" returns the minimum of field "Dates" and transform it into text type:

Pascal_Gallais_6-1727949624353.png

Field "Next date" makes the result look like a date:

Pascal_Gallais_7-1727949692411.png

Note that this field is a text type field, not a calendar type.

Regards,

Pascal

bitstreams_red
6 - Interface Innovator
6 - Interface Innovator

wow, that worked perfectly, thank you so much. I especially like the old_school right/mid/left string manipulation at the end.

bitstreams_red
6 - Interface Innovator
6 - Interface Innovator

ok - slight final glitch. I wanted to add the 'Next date' field to a timeline view, but Timeline only allows you to add a 'Date' field to the view and this is a formula field.

Hello,

Try to use this formula to transform field "Next Date" into a calendar field type:

Pascal_Gallais_0-1727955738703.png

Regards,

Pascal

bitstreams_red
6 - Interface Innovator
6 - Interface Innovator

Yes, that works, though it sees 03/10/2024 as 10th March 24 not 3rd Oct 24, as we're in the UK.

Yes, you are right, I would advise to modify the "Next date" formula to express it in US format:

Pascal_Gallais_0-1727957506996.png

You can then choose what date format shall be applied on the "final date" formula field (European in this example):

Pascal_Gallais_1-1727957594297.png

Regards,

Pascal

Hm I realize your problem's already solved but I'm curious about the business logic here.  In the "Case Activity" table, do you have some sort of status marker to indicate whether the activity has been completed?

Yes I do and I will need to handle overdue activities but I wanted to play with a timeline view that showed what was due to happen this week. It may be that it's not a linear path, so there are activities that are overdue but others are scheduled and can be performed on time.

Hmm, I wonder if it's possible to filter the date lookup field instead to achieve your desired result:

Screenshot 2024-10-06 at 12.49.12 PM.png

Screenshot 2024-10-06 at 12.49.14 PM.png

Screenshot 2024-10-06 at 12.48.11 PM.png

Link to base

Very simplified example that assumes we can use the Status fields to filter for what your business logic needs, of course