|
POST
|
We have some users that would like a way to reorder the fields of a feature class. I was hoping the field map control in the Merge tool would let you reorder but the up and down arrows in the box have no effect. After doing some searching, all the solutions I found required some coding. I developed a Python script based on the work by Josh Werts but they want something that works without looking at code. I was wondering if I could use the logic from the Python script and populate a multivalue parameter control in Model Builder with a list of field names, the user could rearrange it and then put it back into the Python script as a list for creating the new field map (which is then run through Merge to make the final feature class). I am pretty familiar with Python, but not so much with Model Builder. Any suggestions on the best way to accomplish this? The process would be like: Input FC Display fields User reorders fields in control Reordered fields are used in field map Field map used in Merge to output new FC with reordered fields
... View more
03-04-2015
09:04 AM
|
0
|
0
|
1848
|
|
POST
|
Just copy and paste your code into the post as plain text; forget the syntax highlighting.
... View more
03-04-2015
08:36 AM
|
0
|
1
|
618
|
|
POST
|
There should be a "Use advanced editor" link in the upper right corner of the reply box. What browser are you using? Re: How to format a code sample on GeoNet?
... View more
03-04-2015
08:28 AM
|
0
|
3
|
2299
|
|
POST
|
Your link is doubled up. I think you meant to go to ArcGIS Help 10.2 - Workspace properties (arcpy)
... View more
03-04-2015
07:58 AM
|
0
|
1
|
2299
|
|
POST
|
Thanks for posting your code, but a screenshot is not very helpful if someone wants to copy it. Please post again as text with Python syntax highlighting. Posting Code blocks in the new GeoNet
... View more
03-04-2015
07:55 AM
|
0
|
0
|
2299
|
|
POST
|
I haven't seen anything that will let you release specific locks like that. I think the best you can do is just disconenct the user from SDE. However, you should disconnect all users for a compress anyway. If you have a different script that needs access to a particular table, you could use the Registration_ID from SDE.Table_Registry table to find any locks on it in the SDE.Table_Locks table. If there are locks listed for that table, you could take the SDE_ID of the lock(s) and use DisconnectUser() to kick just that person (or persons) with the locks. You can get detailed connection information about a particular SDE_ID in the SDE.Process_Information table or with ListUsers(). You can query all these SDE tables with arcpy using ArcSDESQLExecute().
... View more
03-03-2015
11:09 AM
|
1
|
1
|
1410
|
|
POST
|
Might be better (cleaner) to use string format(). Based on the correct answer from Darren Wiens, this is what I would do. counter = 0
with arcpy.da.UpdateCursor(table, [field]) as cursor:
for row in cursor:
if row[0] == find:
row[0] = replace
cursor.updateRow(row)
counter += 1
print "{} items processed".format(count)
return counter
... View more
02-27-2015
03:42 PM
|
0
|
0
|
3034
|
|
POST
|
The version has to be created as Public or Protected if you are not the owner and need to view it. If the version is Private, you have to be the owner. ArcGIS Help 10.2 - Creating versions and setting permissions
... View more
02-27-2015
10:38 AM
|
1
|
1
|
3989
|
|
POST
|
Oh, so the version you make is created under another version that has changes you want to see? Were you using arcpy.ChangeVersion_management() to change versions? Can the changes in the parent version be posted up so you can just do the script work on Default?
... View more
02-27-2015
10:29 AM
|
0
|
4
|
3989
|
|
POST
|
Try reconciling the version before you delete it. However, I still don't understand the requirement to do this work in a version if you're only selecting features and exporting them. If you are not editing geometry or attributes, I don't think you need a version.
... View more
02-27-2015
10:19 AM
|
1
|
7
|
3989
|
|
DOC
|
Thanks for the new download. I'm trying to read through the code and I noticed there are no real comments! Looks like your test code at the bottom had comments though. Even some basic comments would be helpful, especially if you plan to share your code.
... View more
02-20-2015
02:31 PM
|
1
|
0
|
2639
|
|
POST
|
There are some basic examples in the Esri help documentation ArcGIS Help 10.2 - SearchCursor (arcpy.da) For your particular code, it's as simple as just starting with the cursors in nested with statements and removing the del lines afterwards. with arcpy.SearchCursor(r"C:\gishome\tasks\flood_warning_system\jetConnectForDvLive.odc\last3days") as accessRows:
with arcpy.InsertCursor(r"C:\gishome\tasks\flood_warning_system\_SPW_GDBMGR@GIS_PW_SWM.sde\tblGageData") as curSde:
for cRow in accessRows:
# Loop through the results returned via the OLE DB connection
##
#Insert a new row into the SDE table with the current DIADvisor record's information
##
print "Number of record(s) in the DIADvisor database: " + str(counter)
print "Processing end time: " + str(datetime.now())
... View more
02-20-2015
02:23 PM
|
1
|
1
|
3028
|
|
POST
|
I second this. Use the arcpy.da module for cursors and use them in a with statement so the cursors are automatically deleted even if there was an error. Your current code may not delete the cursors if there was an error.
... View more
02-20-2015
02:01 PM
|
0
|
3
|
3028
|
|
DOC
|
I don't see a .esriaddin file included in your .zip download.
... View more
02-19-2015
02:28 PM
|
0
|
0
|
2639
|
|
DOC
|
A potential use might be to decide which tool to use on the fly (maybe while iterating through a geodatabase with arcpy.da.walk) depending on if you're looking at a table or a feature class. Like make a feature layer or a table view. Still don't know what particular use case would require that. I'm sure someone's needed this though!
... View more
02-19-2015
01:28 PM
|
0
|
0
|
2794
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-23-2025 03:53 PM | |
| 1 | 3 weeks ago | |
| 1 | 03-19-2026 08:59 AM | |
| 1 | 02-12-2026 01:37 PM | |
| 1 | 12-01-2025 06:19 AM |