Select to view content in your preferred language

Time Sequential Values

842
3
Jump to solution
09-11-2019 11:36 AM
AbiRoberts
Occasional Contributor

Hello! I hate to rehash old threads but, despite my research,I am still confused on how to determine the difference between sequential values in rows of the same field. In my case specifically - times in rows of the same field. Would anyone be so kind as to help? I happened across Table_tools_pro by Dan_Patterson, but the sequential calculator only works on numeric fields. Is this something that *should* be able to change easily? Or is there another way?

In this code: https://community.esri.com/thread/215566-sequential-difference-in-a-single-column-with-field-calcula....  Curr_val is referencing the field in the expression block (!RasterValu!) correct? Which would be whatever field I am trying to obtain values from? Will this work on a date field? 

Should I instead be attempting to use the datetime.timedelta() in the field calculator?

I have seen some threads referencing cursors but I have not yet reached that level of Python 3 #master and I think I am at the point where I know enough to know that I have a long ways to go.

Any help would be greatly appreciated.

0 Kudos
1 Solution

Accepted Solutions
AbiRoberts
Occasional Contributor

I figured it out!

It seems that my problem was not the code for determining the sequential time but the function created to calculate it. It was passed two different data types and it only works if it is passed the text variable before the numeric variable. Also I (may have un-necessarily?) used import datetime from datetime, which appeared to help..

View solution in original post

0 Kudos
3 Replies
DanPatterson_Retired
MVP Emeritus

Abi... what is the exact format of your field?  Featureclass in a geodatabase?

There are ways to calculate differences in time values using python

AbiRoberts
Occasional Contributor

  Hi Dan! It is a point feature class in a geodatabase. The attribute table for the points contain time stamps, one with a date type and another with text type. 

0 Kudos
AbiRoberts
Occasional Contributor

I figured it out!

It seems that my problem was not the code for determining the sequential time but the function created to calculate it. It was passed two different data types and it only works if it is passed the text variable before the numeric variable. Also I (may have un-necessarily?) used import datetime from datetime, which appeared to help..

0 Kudos