*In this short tutorial I will discuss performing Partial String Searches and Converting Field Data Types in ArcGIS * Using the LIKE operator in the Attribute Selection dialog box allows you build selection queries to select partial values of strings. For instance, say you are interested in selecting all states that start with the letter ‘W’, or selecting all contour lines that end in 0 or 5 to build a 5ft contour base from a 1ft contour line dataset. If you are interested in searching through a field that is not a string value (e.g., integer, float, double) you will need to convert that column to a string, or Text, values. Skip ahead to Partial Selections if you’re not working with integers, floats or doubles Converting non-text field values to text values Open the Attribute Table and click the Table Options button and select Add Field.
In the Add Field dialog box, give your new field a name (I suggest appending the name with _STR) and for the type select “Text.” Click OK.
The new column should now be added to the attribute table. Now use the Field Calculator to bring the values from the non-string column you’re interested in. To do this, right click on the new field and select Field Calculator. If you’re not in an edit session, an alert message will pop up, it’s just warning you that you cannot undo any results that are calculated. That’s okay, click Yes. In the Field Calculator window, double click the field you are interested in selecting from. Essentially, what we’re doing is copying the data from the original column that is in non-string (non-text) format, and turning it into string (text) format for partial selecting.
Click OK and the new values generated should be a copy of the original field, in text format.
**Partial Selections **Open the Select By Attributes window by clicking Selection > Select By Attributes. Double click the new field that was just created to add it to the selection query. Click the LIKE button. Use the % sign to tell the query that any value is acceptable in its place.
For instance, in this scenario I am interested in selecting all values of elevation that end in 0. I would write ‘%0’ to indicate that any value that comes before 0 is acceptable. The entire query that would be built would be “
your_new_field_string” LIKE ‘%0’ NOTE: You must use single quotes following the LIKE You could also use the % sign to select all states beginning with the letter W by writing “state_name_field” LIKE ‘W%’ Partial String Selection allows for more complex selections from your data and is a great way to perform advanced selection queries. For more information on using the Select by Attributes function in ArcGIS, see their Help Guide on it.