|
POST
|
There could be a more elegant way, but this should do the trick: >>> a = 'AKRON, OH 12345'
>>> alist = a.split(",")
>>> city = alist[0].title()
>>> final = city + "," + alist[1]
>>> print final
Akron, OH 12345
... View more
03-14-2013
02:47 PM
|
0
|
0
|
1619
|
|
POST
|
I think the issue is with your Expression variable. Here is what you have: UpdatedField = "Update"
Expression = (" = " + "'" + arcpy.GetParameter(3) + "'")
arcpy.CalculateField_management(Selected_cnddb_point, UpdatedField, Expression, "PYTHON") If your user entered parameter was "hello", the expression would be: ='hello' and not: "Update" = 'hello'. I think your Expression variable should actually be: Expression = '"Update" = ' + "'" + arcpy.GetParameter(3) + "'"
... View more
03-14-2013
12:57 PM
|
0
|
0
|
1873
|
|
POST
|
You could probably use an Update Cursor within the onEnter function so you could enter some information into the box, then hit enter. The cursor should respect the selection.
... View more
03-14-2013
10:37 AM
|
0
|
0
|
1183
|
|
POST
|
Have you ran this in ArcMap instead of Eclipse and the Python Shell? Also, are you at 10.1?
... View more
03-13-2013
10:25 AM
|
0
|
0
|
2363
|
|
POST
|
Babak- Did you try it with a fc instead of shp? It seems to work just the same for me. Did you make sure to have a selection on the layer? The FIDSet will return a semicolon-delimited string of selected feature IDs. Luke
... View more
03-13-2013
09:01 AM
|
0
|
0
|
6169
|
|
POST
|
"Otherwise, an easy thing to do to see if it is working is to just watch your workspace in Windows Explorer and see if you see either a shared or exclusive lock file is being applied. They should be pretty easy to spot and will show up as a data type of LOCK." Would this method of spotting lock files only apply to shapefile, personal and file geodatabases? Would you need to worry about locks from arcpy.da if you are working with an SDE geodatabase that is built to accomodate multiple users? It will work well for shapefile and file gdb. Personal geodatabases are a bit different, as locks occur at the geodatabase level. However, you can see the locks on the entire mdb. I only tested the "with" bug on a file gdb, but I imagine the input data type shouldn't make a difference. I would say regardless of what database you are going through and regardless of what technology you are using to do a cursor (i.e. whether through arcpy or not), you should always remove the locks to take them out of memory.
... View more
03-12-2013
04:44 PM
|
0
|
0
|
3320
|
|
POST
|
If you are at 10.1, you can just test to see if a value is Null by checking to see if it equals None. This is highlighted in KB 40913. You should be able to do something like: def dateDiff(date):
from datetime import datetime
if date is None:
pass
else:
return int((datetime.now( ) - datetime.strptime(date,"%m/%d/%Y")).days/365.2425)
... View more
03-12-2013
02:57 PM
|
0
|
0
|
1627
|
|
POST
|
Yeah, I just entered it last week, so it usually takes a few days.
... View more
03-12-2013
08:43 AM
|
0
|
0
|
3320
|
|
POST
|
The second statement should release the locks automatically, but there appears to be a bug with this- NIM089529: The data access arcpy cursors do not release locks when using with statement. Otherwise, an easy thing to do to see if it is working is to just watch your workspace in Windows Explorer and see if you see either a shared or exclusive lock file is being applied. They should be pretty easy to spot and will show up as a data type of LOCK.
... View more
03-12-2013
08:22 AM
|
0
|
0
|
3317
|
|
POST
|
Do you have Advanced for Desktop (I know you said standard for Server)? The Feature to Polygon requires an Advanced license.
... View more
03-12-2013
08:06 AM
|
0
|
0
|
1175
|
|
POST
|
I put in a usability bug because it seems that a feature dataset is a workspace (and you can set it in the GP Environments and through arcpy.env.workspace). Here is the number- NIM089681: Cannot set workspace to a feature dataset when workspace is a model parameter
... View more
03-11-2013
04:44 PM
|
0
|
0
|
2611
|
|
POST
|
Scott, you might try posting in the ArcPad thread and you'll probably get a quicker answer. -Luke
... View more
03-11-2013
01:50 PM
|
0
|
0
|
738
|
|
POST
|
What coordinate system is defined for your shapefile? If you could, you can upload a subset of your data and give me an example of what your workflow is and I can take a look for you.
... View more
03-11-2013
09:43 AM
|
0
|
0
|
1170
|
|
POST
|
This is possible through using Python Add-ins. You could use a combo box to list all of your clients and have another combo box that lists possible years, depending on the value selected in the first combo box.
... View more
03-11-2013
09:33 AM
|
0
|
0
|
1183
|
|
POST
|
Maybe you should try, expression = !field! + ", " + str(parameter) I agree. James, what is the data type of your field? If you set parameter = 4, that is making it an integer. To make that a string you would need to say parameter = "4". Because you cannot concatenate strings with integers, you will need to make sure the two match. If field is a string, set parameter = "4". If the field is an integer, you will want to set parameter = 4. Otherwise, you can cast it to string or int in the expression by saying int(parameter) or str(parameter), just as suggested above.
... View more
03-11-2013
08:51 AM
|
0
|
0
|
1073
|
| Title | Kudos | Posted |
|---|---|---|
| 3 | a month ago | |
| 1 | 11-24-2025 10:45 AM | |
| 1 | 07-30-2025 08:26 AM | |
| 1 | 05-15-2025 07:35 AM | |
| 2 | 11-26-2024 01:27 PM |
| Online Status |
Offline
|
| Date Last Visited |
a week ago
|