calculate date from linked items
Hi there,
I have a clients app an an app where I document appointments with my clients.
Now I want to display all clients, where the last appointment is more than 14 days in the past, so I want to have a calculated field 'last appointment + 14 days' so I can create a view correspondingly.
When I use the calculation: '@Max of Datum' the most recent date of the linked appointment-items is displayed. So far so good.
When I want to calculate (recent date plus 14 days), Podio throws an error.
I use the fomula from the tutorial-pdf:
d = new Date(@Max of Datum);
d.setDate(d.getDate() + (14));
moment(d).format("DD/MM/YYYY");
but the system throws 'unexpected token ILLEGAL' (even after the very first line).
What's wrong?
Stefan
-
Hi Stefan,
that's much more complex cause Podio doesn't have a variable for current time, day, week etc. - you need a workaround to create your own "Current day" variable. More about this issue: https://help.podio.com/hc/en-us/community/posts/204569657-Definite-solution-for-today-handling-in-calculated-fields-days-since-days-until-countdown-incl-possible-solution
If you have that variable you can do:var max = moment(@max of date);
var today = moment(@today) // today is what you need to create by the workaround
today.diff(max,"d")+1,The result is number which shows how many days ago the last appointment was. Now you can create a view . Filter on that calculation field: From 15 - it shows all clients with last appointment more than 14 days ago. Save that view. This allows you also to create different views, e.g from 15 to 30 (days ago), from 31-45 (days ago) etc.
Rainer
Please sign in to leave a comment.
Comments
1 comment