Select to view content in your preferred language

Calculated expressions fail when Date field is filled out

93
4
Jump to solution
Wednesday
AmberMillison
Frequent Contributor

Hello, I created a feature class using the Field Maps Designer. I have a Date field (called Manufacture_Date) that is input manually, but is used in a calculated expression for another field (titled Age). I also have several other fields using calculated expressions that do not use the my Manufacture_Date field. When I collect a point, all my calculated expressions work as they are supposed to, until I start filling out the Manufacture_Date field. Then, all my calculated expressions stop working, including ones that do not even use Manufacture_Date in the expression. I have another Date field (Install_Date) that is the exact same field type and has the same properties as Manufacture_Date, except it is not used in any subsequent calculated expressions. When I fill out Install_Date, my calculated expressions continue to work just fine. So the source of the error is something to do with my Manufacture_Date being used in a calculated expression. 

I have pictures showing the error below. In the first photo, the last 2 fields are generated from calculated expressions (my name and the time that the point is collected, neither are based on the Manufacture_Date field). These work fine until I fill out Manufacture_Date, and then the results of these calculated expressions go away.

Has anyone seen a similar issue and are there any known workarounds? 

0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

Since you haven't specified the units for the DateDiff function, it's going to return the difference in milliseconds. What happens if you format to return it in years (and round it to two decimal places)?

Round(DateDiff(Now(), $feature.Manufacture_date, 'years'), 2);

 

View solution in original post

4 Replies
KenBuja
MVP Esteemed Contributor

What do the calculated expressions that use the Manufacture_Date field look like?

0 Kudos
AmberMillison
Frequent Contributor

Hello, this is what I have:

AmberMillison_0-1755108214742.png

 

0 Kudos
KenBuja
MVP Esteemed Contributor

Since you haven't specified the units for the DateDiff function, it's going to return the difference in milliseconds. What happens if you format to return it in years (and round it to two decimal places)?

Round(DateDiff(Now(), $feature.Manufacture_date, 'years'), 2);

 

AmberMillison
Frequent Contributor

Thank you so much!! This fixed it!! 🙂

0 Kudos