Hello Michael,
The return is milliseconds so if you divide by 86400000 (the number of milliseconds in a day) it will give you the number of days. e.g.
({{field_1__c}} - {{field_2__c}})/86400000
Cheers
Damien
Hey Thanks for the reply. If you look at my second image you can see I am doing just that. Yet still zeros! I tried taking the difference between TODAY() and one of my dates and got a non-zero result. Perhaps there is a format issue with these dates?
Good tip, Damien! But I see that value in Michael’s code, as 1000246060.
Michael, what kind of date values are you comparing? The Floor() function will give you a 0 for anything less than 1 full day difference. I would recommend increasing the decimal places to 1 or 2, removing the Floor() function, and dividing by 100060*60 to look at minutes until you see what the formula is giving you.
Try another bracket ) at the end.
Alternatively, try it without floor as it shouldn’t matter if they are normal date fields
Similar to what Mike said, I would add one variable in at a time and see what the result is. So start with {{Service_Start _Date__c}} and see what the result is. If that is what is expected then add the next piece of the equation in and check the result… then the next piece… etc… until you find what part of the equation is causing it to return 0.
Michael,
Try doing the Floor on just the numerator.
FLOOR( {{Service_Start_Date__c}} - {{Implementation_Manager__r.CS_Start_Date__c}}) / (10002460*60)
Thanks,
Bill
Hi All,
Thanks for the great replies. Following Raymond’s advice I have eliminated everything and tried testing the output of a single variable and found that I cannot get any field to display. I have tried numbers and dates with matching return type and still nothing is showing up in the table.
Note that I am attempting to create this UI field within an Aggregate Model (for what it’s worth). Each row is an opportunity with a service start date in which I would like to have another field counting days from that date and another (for each opp record). Then on a chart I am plotting the cumulative number of opps by owner.
Is there some sort of trick for getting UI fields to pull in merge fields on an Agg model?
Thanks all.
This post is about a different use case, but it includes a lot of tips regarding working with UI only formula fields with agg models. https://community.skuid.com/t/using-model-lookup-with-ui-only-field-cant-make-it-work
I discovered I am able to achieve what I need using a basic type model. Taking the difference of the two dates as described above worked perfectly. Onward and upward!