Post

2 followers Follow
0
Avatar

How do I calculate a followup date?

I have an app called "Everyone" that contains all of my leads. This app references another app called "Contact Frequency" which has options such as "Daily", "Weekly" and "Monthly." I also have an app called "Conversations" where I enter my conversations with people in my database.

I want to have a calculation field in my "Everyone" app that displays the next contact date based on the "Contact Frequency" for that person.

I have been able to create a calculation field called "Last Contact Date" that displays the most recent conversation using "@Max of Date Of Contact"

As many have found out - this doesn't display correctly due to how Podio handles time zones. I have seen suggestions in this community to use the moment function but unfortunately I get all sorts of errors (such as "TypeError: undefined is not a function") when I try to do so. See examples below

or this error: "The type of result changed from number to text."

 

 

I appreciate anyone that can help guide me with this. Thank you.

John Stiles

Please sign in to leave a comment.

4 comments

0
Avatar

Hi John, 

1. tz-issue: you must wrap the timezone in quotation marks: .tz('America/Chicago')
2. "The type of result changed from number to text." - please read this (the paragraph above the video): https://help.podio.com/hc/en-us/articles/201019358-Calculations

3. The calculation:

var frq = @all of frequency.toString();
var frq = frq == "Daily" ? "days" : frq == "Weekly" ? "weeks" : "months" 
var lastDate = @max of date of contact;
moment(lastDate).add(1,frq).tz('America/Chicago').format('MM DD YYYY')

Replace @all of frequency with the correct name of the category field.
Rainer

 

Rainer Grabowski 0 votes
Comment actions Permalink
0
Avatar

Thanks for your input Rainer.

I used your code but it isn't producing the expected result. 

One change from my original post - I have many different frequency options and in that app that contains those options I have a separate field that has a corresponding number of days. I.E. Daily = 1; Bi-Weekly = 4, etc.

Is there a calculation we can write that will use the number field and apply it do the days?

Thank you again!

John Stiles 0 votes
Comment actions Permalink
0
Avatar

Sure, my proposed calculation can't work cause it was made for the setup described in your first posting :)
For the new scenario: 

var frq = @max of number;
var lastDate = @max of date of contact;
moment(lastDate).add(frq,"days").tz('America/Chicago').format('MM DD YYYY')

Rainer

Rainer Grabowski 0 votes
Comment actions Permalink
0
Avatar

Thank you very much Rainer. You have been very helpful and your calculation worked!

I made a slight change: 

var frq = @max of number + 1:

As I'm sure you're aware - something to do with the default time when non is selected in the date field that is being read causes the date in the calculation to not be my desired result. I believe I've seen you (or someone else) describe a different way to fix this but the +1 seems to be working for me.

Thank you again.
John Stiles 0 votes
Comment actions Permalink