0

enter image description here

enter image description here

I have successfully created the Minimum date and time variable as well as the maximum date and time variable(date datatype). I am only looking 30 seconds in either direction from the record I am querying. My problem is when I try to do an in line substation for the select layer by attribute it will not accept [Date_stamp] >= %#Min_Query#% it says there was a syntax error. The field I am querying is a date and time field and the variable I am using is a date time variable. Both appear to always have an associated time. I added a picture to show exact formats.

I am using ArcMap 10.6.

  • When you reference a variable it is between % not %# so it should be %Min_Query%. – Hornbydd Sep 4 at 14:48
  • I read elsewhere that dates are treated differently. However I get the same syntax error with ([Date_stamp] >= %Min_Query%). I get a data mismatch with ([RoundTime_UTC] >= '%Min_Query%') and ('[RoundTime_UTC] >= '%#Min_Quer#y%') – Damned_Novice Sep 4 at 14:58
0

How you process date time values is dependant on your database format. Here is a test model:

Model

I use the Calculate Value tool to create a datetime object:

Calculate Value

In the Select Layer by attribute tool the expression is:

dt > date '%dt%'

In a file geodatabase you need to place the word date before your quoted inline substitution variable.

This creates a selection based upon a field called dt in a layer.

Selected

  • I tried to recreate your attribute query but, '[RoundTime_UTC] <= date '%Nowtime%'', my field name has brackets around it. I am using a personal geodatabase and not a file geodatabase. I do not know if that makes a difference. When I got to verify it says missing operator. – Damned_Novice Sep 4 at 17:43
  • Check out the help file here. – Hornbydd Sep 4 at 18:29
  • May it should be something like: [RoundTime_UTC] <= #%Nowtime%# ? – Hornbydd Sep 4 at 18:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.