Tuesday, June 22, 2010

SharePoint 2010: Using the Lookup Column to Provide a Multi-Field Drop Down !

Recently a question was posted to the comments of my blog that in summary was asking if there is a way to combine several fields into the value that is used for the lookup. The specific scenario was that they wanted to show the users more of a description of the lookup item than just the title (or in their case, an ID number). There is no way to configure this using the lookup column settings, however below I will describe a way that can be used to easily get you to the same point. Here are two screenshots of what our overall goals:

  • Allow Users to be able to see a multi-field description for their lookup item:

  • Have the items used in the lookup be individual columns in the list, for filtering, sorting and grouping purposes:

We are basically going to use the same instructions found in this blog post, with just a few minor changes. The first change is in the list that we are looking up. We will still build the list normally; we are just going to add one additional column, a calculated column that will be used to build the lookup value we want our users to see. In my example, the calculated column is just a concatenation of 3 text fields.

Now, on the list we where we want to use the lookup, we will configure that list to look up against the Filter Value column we created and then to also pull to the list the additional columns we want to view. The final step is to then remove the Filter Value from the view. This will then allow you to see the filter value when you add / edit items, but when you view the list you will just see the associated columns.

Doing this allows us to reach the goals stated at the beginning of this post. Now, since we are using the calculated column, we would have any limitations that apply to those columns applied to our solution. So this is one of those cases that might not work for everything, but should definitely be a tool in your toolbox in case it comes up!

Thanks for the great questions in the comments section! I hope you will post more as you have them.

No comments:

Post a Comment