# QGIS: cambia i valori da stringa a numero nello shapefile

In QGIS, puoi convertire una stringa in un numero usando lo strumento "Calcolatore di campi". Per prima cosa, apri la tabella degli attributi del layer che desideri modificare. Quindi, fai clic sul pulsante "Apri Calcolatore di campi". Nella casella "Espressione", digita "to\_real(" seguito dal nome del campo contenente la stringa che vuoi convertire, e la parentesi di chiusura. Per esempio, per convertire un campo stringa chiamato "string\_field" in un campo numerico, inserisci "to\_real("string\_field")" nella casella Espressione. Puoi anche modificare il nome del campo di output e il tipo di dato selezionando le opzioni appropriate. Infine, fai clic su "OK" per completare la conversione. Il campo stringa originale rimarrà nella tabella degli attributi, mentre il nuovo campo numerico verrà aggiunto alla tabella.

<figure><img src="/files/e03307775a4dbbf16a63dcb8da1a0f75b0f1ebaf" alt=""><figcaption></figcaption></figure>

1. Apri "Proprietà"
2. Vai a "Calcolatore di campi"
3. Seleziona "Aggiorna campo esistente"
4. to\_real("attributeName")
5. Salva le modifiche
6. Ripeti la stessa operazione per ogni attributo

   <figure><img src="/files/d70f4a1bde3aed1741e5fbb41a5367c481bf4be3" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.geopard.tech/geopard-tutorials/it/suggerimenti-rapidi-gis/qgis-cambia-i-valori-da-stringa-a-numero-nello-shapefile.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
