Hi
Im trying to assign values to a field by choosing a start value for a certain ID and having an increment and let the other field ID's automatically update with values depending on the start value and increment.
This involves referencing to the "row" or ID of the Field where i want the numbering to start. How do I update other rows in a field to make them dependent on a certain cell in the attribute table?
Thanks,
Br
Haakon Haugerud
if you are using cursors, you will have to do it twice... the first time to get the value for the ID you want to use as the base, then again (reset the cursor may be needed) to use the value.
You might have better luck exporting your fields to a numpy array (TableToNumPyArray), do the work there then use ExtendTable to joining the results back.
Hi Dan,
Thanks for the answer.
So I found a code that might work:
But get error: "parameter is missing or invalid"
You have a calling issue and some indentation issues.
SrtVal = 20
def autoincrement():
global SrtVal
pInterval = 20
if SrtVal == 20:
SrtVal += pInterval
else:
SrtVal += pInterval
return SrtVal
Chainage = autoincrement() # ---- note the ()
Chainage
40
Ok, thank you. Do you have a suggestion on what needs to be changed to solve this?