Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

X fare un dissolve esclusivamente geometrico applicare il dissolve normale ma senza scegliere un “dissolve

field”

Multipart to singlepart per dividere i merged features

Codice phython per generare sequenza numerica

Code:
rec=0
def autoIncrement():
global rec
pStart = 1 #adjust start value, if req'd
pInterval = 1 #adjust interval value, if req'd
if (rec == 0):
rec = pStart
else:
rec = rec + pInterval
return rec

Field_Name:
autoIncrement()

Script per rimpiazzare stringhe di attributi

I have found that in 10.0 Field Calculator is quite weird.

But I've managed to get it work. The main idea is to enclose field name with single quotes.

Example. let suppose we have fields text1 and text2. Rather than Calculating field text2 with
expression !text1!, which probably will fail, try this one: '!text1'. As you see I am using single
quotes here.

So, back to your task. It will be more clear to use Pre-Logic Script Code:

def calc(value):
return value.replace('"', '')

Expression will be:

calc('!text1!')

I hope it will work for you.

I have not experimented further but I think that such weird behavior happens because field
calculation is translated into the call to ArcToolbox tool CalculateField_management and
expression is provided as a parameter to it (probably additionally enclosed with single or double
quotes).

UPDATE:

My previous solution will fail in case if there are single quotes in the values of field text1.
Now I have managed to get it work both in case when there are chars ' and " (single and double
quotes) inside any value in attribute text1.

Here is expression, which will return original string, supporting both types of quotes:

'''!text1!'''[1:-1]

For your task it can be extended to (without Pre-Logic Script Code):

'''!text1!'''[1:-1].replace('"', '')

You might also like