Hello all,
I am attempting to take the difference of two dates (in number of days). Thus far I am unable to get anything to show other than 0. Please see my UI field setup below.
I have even tried just pulling in one of the dates with the return type of date with nothing showing up. Does anyone know what I am doing wrong?
I have been trying to do something similar to:
https://community.skuid.com/skuid/topics/calculateagewithuionlyfield
but again, with no luck.
Thanks,
M$
I am attempting to take the difference of two dates (in number of days). Thus far I am unable to get anything to show other than 0. Please see my UI field setup below.
I have even tried just pulling in one of the dates with the return type of date with nothing showing up. Does anyone know what I am doing wrong?
I have been trying to do something similar to:
https://community.skuid.com/skuid/topics/calculateagewithuionlyfield
but again, with no luck.
Thanks,
M$
 1,908 Points
Posted 3 years ago
 494 Points
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
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
(Edited)
Mike Dwyer, Champion
 4,756 Points
Good tip, Damien! But I see that value in Michael's code, as 1000*24*60*60.
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 1000*60*60 to look at minutes until you see what the formula is giving you.
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 1000*60*60 to look at minutes until you see what the formula is giving you.
Skuidward Tentacles (Raymond), Champion
 18,656 Points
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.
Bill McCullough, Champion
 13,822 Points
Michael,
Try doing the Floor on just the numerator.
FLOOR( {{Service_Start_Date__c}}  {{Implementation_Manager__r.CS_Start_Date__c}}) / (1000*24*60*60)
Thanks,
Bill
Try doing the Floor on just the numerator.
FLOOR( {{Service_Start_Date__c}}  {{Implementation_Manager__r.CS_Start_Date__c}}) / (1000*24*60*60)
Thanks,
Bill
 1,908 Points
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.
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.
Skuidward Tentacles (Raymond), Champion
 18,656 Points
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/skuid/top...
https://community.skuid.com/skuid/top...
 1,908 Points
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!
Related Categories

Skuid on Salesforce
 2907 Conversations
 246 Followers
Michael Schniepp
Damien Murray
Alternatively, try it without floor as it shouldn't matter if they are normal date fields