POST
|
Todd, It actually seems like it has to do with the ObjectIDs. It seems to start over or mess up wherever the objectIDs are not perfectly ascending. For example, some data may have been collected over a large period of time, with other parks' data in between, so the object IDs are chunks at a time. IDs 1-200 and then 2300-2450 might belong to one park,, because other parks' info was taken in between (200-2300). I'm not sure if there is a way around this- incrementing based on *not* the objectIDs, but I used the script that I wrote ^above^ and just executed it individually for each park (i.e. 40+ times), which was not ideal, but worked.
... View more
07-15-2014
08:02 AM
|
0
|
2
|
1179
|
POST
|
Now that I look more closely, I am actually getting a really bizarre output. It seems like some of the Unique IDs are being generated, but some of the are repeating, or restarting again at _001 at random times. Not sure why this would happen. Additionally, some of the Unique IDs are not being generated at all. I'm not sure if they just had not been gotten to before the failure occurred and the values there are leftover from my other trials, or if they are generating just strange numbers in the thousands. Here are some random snippets/examples: Ex. 1 shows random numbers in the thousands in the same park as where _001 starts randomly two times. Ex. 2 shows a park that goes from _001 immediately to _062 Ex. 3 shows a park that goes from _030 to a random numbers, and then a new park begins randomly at _033, and then a new park begins with random numbers. Hayley
... View more
07-15-2014
07:24 AM
|
0
|
0
|
1179
|
POST
|
Thanks for your help, Todd. Unfortunately it did not work. Here are the error results:
... View more
07-14-2014
02:03 PM
|
0
|
0
|
1179
|
POST
|
Additionally, all Park IDs are already entered into a field "ParkID", so it would just be ParkID_001 for each new park
... View more
07-14-2014
10:54 AM
|
0
|
3
|
1179
|
POST
|
Hi Todd The parks are either "QXXX" (i.e. Q001), "XXXX" (i.e. X092), RXXX (i.e. R142), BXXX (i.e. B057), or MXXX (i.e. M321) Thanks.
... View more
07-14-2014
10:23 AM
|
0
|
0
|
1179
|
POST
|
Hi all, I was wondering if you could help me write a script for Field Calculator. I have a list of 2,000+ entries contained in about 40 parks. Each park has a field ParkID which is already filled out. I'd like to create a script that generates UniqueIDs based on the ParkIDs. Ex. ParkID = Q001 .:. UniqueIDs = Q001_001, Q001_002, all the way to Q001_100 or however many necessary depending on how many entries, but then beginning at 001 again when reaching a new park, i.e. R142_001, R142_002, etc. I want to first retrieve each ParkID from the list of ParkIDs and then use that list to create an autoincrement starting at 001 for each unique ParkID. I'd rather do this that just do an autoincrement for each park individually. I have very little python experience and might not quite understand some details, so could you please explain in depth? EDIT: Right now I have the following script in the Codeback of Field Calculator: rec=0 plot = "" def autoIncrement(park): global rec global plot pStart = 1 pInterval = 1 if (rec == 0): rec = pStart plot = park plot = plot + "_000"+ str(rec) rec += pInterval elif (rec < 10): plot = park + "_000" + str(rec) rec += pInterval elif (rec > 9 and rec < 100): plot = park + "_00" + str(rec) rec += pInterval elif (rec > 99 and rec < 1000): plot = park + "_0" + str(rec) rec += pInterval else: plot = park + "_" + str(rec) rec += pInterval return plot And the following in the "FIELD_NAME" = autoIncremet(!ParkID!) This code works, but starts the unique ID at 0 and goes up into the thousands. I am trying to find a way to make it so for each new ParkID, the unique ID restarts at 001 again. Best, Hayley Message was edited by: Hayley Small
... View more
07-14-2014
08:27 AM
|
1
|
14
|
3250
|
Title | Kudos | Posted |
---|---|---|
1 | 07-14-2014 08:27 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|