Python how to compare Date Fields in MakeFeatureLayer

1650
3
Jump to solution
03-01-2016 08:34 AM
JoseSanchez
Occasional Contributor III

Hello everyone,

I exported a ModelBuilder to Python where there is a FeatureLayer where I compare 2 Date Fields and it works fine in Model Builder but in Python it displays the following error message:

ExecuteError: ERROR 000230: Failed selecting with MODDATE <> MODDATE_1 \n\n

Failed to execute (MakeFeatureLayer).

This is the python code:

# Process: Make Feature Layer (5)

arcpy.MakeFeatureLayer_management(Agreement, Agreement_Layer1, "MODDATE <> MODDATE_1 \\n\\n", "", "OBJECTID OBJECTID .... ")

0 Kudos
1 Solution

Accepted Solutions
RandyBurton
MVP Regular Contributor

Have you tried it without the new line codes (\n\n) ? 

"MODDATE <> MODDATE_1"

View solution in original post

3 Replies
RandyBurton
MVP Regular Contributor

Have you tried it without the new line codes (\n\n) ? 

"MODDATE <> MODDATE_1"

XanderBakker
Esri Esteemed Contributor

And if you remove the " \n\n", does it work? The \n refers to additional <Enter> you entered in the expression.

The alternative is to run the tool manually and copy the Python snippet from the Results window:

Using the Results window—Help | ArcGIS for Desktop

JoseSanchez
Occasional Contributor III

Thank you all!!  Removing the \n\n" fixed the problem.

0 Kudos