Sunday, 17 April 2011

SharePoint 2010 Convert Column Type to Lookup

In Sharepoint 2010 I had a list that I created by importing it from a spreadsheet. One of the problems when creating a list from a spreadsheet is that Lookup column types are changed to singleline, (the data value is retained of course).

I wanted to convert this column back to a lookup data type by selecting it from the Library Settings and editing the column settings, but "lookup" is not available, although the "choice" data type is, and selecting the choice data type lists all the original values from the original lookup but its now a choice data type so that won't do if you really want to change it back to a lookup data type.

I found a way to do this by copying and pasting in data sheet view, although there may be a better way, this works just fine:

1. Assume we have a column called "Industry Type" that we want to convert to a lookup data type.

2. Go to the Library Settings and change the column name in question to "Industry Type Old".

3. Create a brand new column as a lookup column with the original column name ("Industry Type" in this example) and in the process reference the required column in the lookup list.

4. Switch to "DataSheet View" for the list.

5. Select the "Industry Type Old" column heading to highlight the whole column and then right click the mouse and select "copy".

6. Select the "Industry Type" column heading to highlight the column and then right click the mouse and select paste.

7. If you did step 6 correctly all your data values should now be in the new lookup column ("Industry Type" for this example). So now just delete the original column (Industry Type Old) from the Library Settings menu and you are done.

Wednesday, 13 April 2011

Sharepoint 2010 multiline to single line column data type conversion

If you create a Sharepoint list by importing a spreadsheet you will find that in Sharepoint 2010 all free text columns are converted to the multiline data type by default.

This is a problem if you want to filter the multiline columns in a list by clicking on the column heading because column filtering will only work if the column is a single line data type.

So to change a multiline data type column to a single line do this:

1.  Browse to the "List Settings" for the list.

2. Click on the multiline column:


3. Change the Rich Text property to Plain text and press OK. Press OK again when warned:


4. Select the same column again as in step 2.

5. You should now see an option to change the data type to Single line of text. Press OK when done and press OK to the warning:



You can also do this in Sharepoint 2010 Designer but you must first change the Rich text setting to Plain text and save the changes, then change from multiline to single line, click off the column, OK the warning then save again.