Why is MOD(OBJECTID,30)=0 an invalid expression?
I have a feature class with a field 'OBJECTID', it appears automatically when typing the SQL syntax. I tried this in v2.4 and 2.3. Both places it says invalid syntax. It works, however, in another map. The first OBJECTID value is 281. There are 290 records. If i create another field (LONG data type) and subtract 280 from the OBJECTID field and put the result in this new field, so it starts at 1, and then use that field in the MOD expression, it still fails. The data comes from a SDE.
I hate queries. I prefer to add a field to the table so I have a record of whether a condition was met.
math.fmod(!OBJECTID!,2) == 0.0 # check for divisible by 2, returns 0 or 1
Often times with enterprise geodatabases, the syntax is dependent on the specific DBMS. What DBMS are you using?
It worked for me in file gdb:
I was picking up on the "data comes from a SDE" part of the question. If the data is coming from SQL Server, MOD is not recognized, which may or may not be the issue.
SQL Server MOD is %:
OBJECTID % 30 = 0