I have developed a model that the first step is to select records for a table with field name Sales, I manually now change sql expression from Sale 1 to Sale 2 etc, there are about 50 groups of sales. Once the group is selected, it then is joined with a polygon feature Parcels, records copied, join removed and then onto the next group of sales (There are upto 50 sales for each parcel, so a simple join doesn't work,)
I would like to automate the sql expression that initially selects the records, so that once the first group of sales is copied, join removed, the table then selects the next group of sales. Also I need a way to change the name of the copied features to match the sales group, so it doesn't overwrite.
The model works fine now, except that I must manually change the sql expression after each sale group and change the copied features name so it doesn't overwrite the previous sales group.
How can I automate the sql expression, if that is the appropriate approach?
Thank you.
I am using list comprehensions all over my code now and have experienced no problems. Until one crops up, I will continue to use them.
I haven't had any negative experience with them either and truly believe that a day without list comprehensions is a day not lived (or coded actually)...
I think insert and update cursors were more the target for enabling with statements than search cursors, but people have a tendency to want to keep best practices simple. Instead of having one best practice for insert and update cursors and a different one for search cursors, we have ended up with one for all three.
I like list comprehensions, and I think they can work well with search cursors. I was just pointing out the trade-offs of the two approaches, not trying to evangelize one over the other.
Xander is that in Python Snippets?
Hi Dan,
I have a separate post on that... Using Python List Comprehensions
May have to rethink the python snippets and move things over to the python snippets place..
Thank you, does this then allow me to group by sales grouping, ie Sales 1, say 100 records, then join them to a parcel map, copy features, then go on to the next Sales Group 2, say 200 records and repeat join copy records?
Thank you for your help,
I'm getting this error, what do you Think I'm doing wrong??
Runtime error Traceback (most recent call last): File "<string>", line 24, in <module> File "c:\program files\arcgis\desktop10.1\arcpy\arcpy\management.py", line 5748, in MakeFeatureLayer raise e ExecuteError: ERROR 000840: The value is not a Feature Layer.
What is the backend storage format? File geodatabase? ArcSDE geodatabase? I ask because there may be other approaches that work more efficiently if the data is all stored in a DBMS.
I'm now getting a "Parsing error SyntaxError: invalid syntax (line 1)", which is the import arcpy statement. what could I now be doing wrong? I'm typing import arcpy??
Can you include more of the error message?