A powerful feature of SharePoint 2010 lists and
libraries is the ability for an administrator to customize the list or
library in many ways, one of which is to add columns, similar to the
process of adding a column in Excel. This is accomplished from the
Document Library Settings page, which is reached by entering the
document library, clicking the Library tab on the Ribbon, and then
clicking the Library Settings icon on the right side of the toolbar.
Only users with the manage lists permission will be able to click the
Library Settings icon; it is grayed out for other users. By default,
members of the Owners, Designers, and Hierarchy Managers groups have
manage lists permissions.
After on the Document
Library Settings page, the Columns section is found midway down the
page, and provides the options of Create Column, Add from Existing Site
Columns, Column Ordering, and Indexed Columns. If Create Column is
clicked, the administrator will have a selection of columns to choose
from, which will vary slightly based on the version of SharePoint 2010
in use because SharePoint Foundation 2010 will not offer the Managed
Metadata option. Descriptions of these columns are as follows:
Single line of text—
Has the following options: Description (text), Require That This Column
Contains Information (Yes or No), Enforce Unique Values (Yes or No),
Maximum Number of Characters, Default Value (Text or Calculated Value),
Add to All Content Types, and Add to Default View. Multiple lines of text—
Has the following options: Description (text), Require That This Column
Contains Information (Yes or No), Allow Unlimited Length in Document
Libraries (Yes or No), Number of Lines for Editing (Integer), Add to All
Content Types (Yes or No), and Add to Default View (Yes or No). Choice (menu to choose from)—
Has the following options: Description (text), Require That This Column
Contains Information (Yes or No), Enforce Unique Values (Yes or No),
Type Each Choice on a Separate Line, Display Choices Using (Drop-Down
Menu, Radio Buttons, Checkboxes [Allow Multiple Selections]), Allow
Fill-in Choices (Yes or No), Default Value (Text or Calculated Value),
Add to All Content Types (Yes or No), and Add to Default View (Yes or
No). Number—
Has the following options: Description (text), Require That This Column
Contains Information (Yes or No), Enforce Unique Values (Yes or No),
Specify a Minimum and Maximum Allowed Value (Two Integers), Number of
Decimal Places (Integer), Default Value (Number or Calculated Value),
Show as a Percentage (for example, 50%), Add to All Content Types (Yes
or No), and Add to Default View (Yes or No). Currency—
Has the following options: Description (text), Require That This Column
Contains Information (Yes or No), Enforce Unique Values (Yes or No),
Specify a Minimum and Maximum Allowed Value (Two Integers), Number of
Decimal Places (Integer), Default Value (Currency or Calculated Value),
Currency Format (for example, United States), Add to All Content Types
(Yes or No), and Add to Default View (Yes or No). Date and Time—
Has the following options: Description (text), Require That This Column
Contains Information (Yes or No), Enforce Unique Values (Yes or No),
Date and Time Format (Date Only, Date & Time), Default Value (None,
Today’s Date, Date in M/D/YYYY format) or Calculated Value), Add to All
Content Types (Yes or No), and Add to Default View (Yes or No). Lookup (information already on this site)—
Has the following options: Description (text), Require That This Column
Contains Information (Yes or No), Enforce Unique Values (Yes or No),
Get Information From (drop-down menu to select list or library), In This
Column (drop-down menu to select the column), Allow Multiple Values
(Yes, No), Allow Unlimited Length in Document Libraries (Yes, No), Add a
Column to Show Each of These Additional Fields (Title, Expires, ID,
Modified, Created, Version, Title [linked to item[), Add to All Content
Types (Yes or No), Add to Default View (Yes or No), and Enforce
Relationship Behavior (Restrict Delete, Cascade Delete). Yes/No (check box)—
Has the following options: Description (text), Default Value (Yes or
No), Add to All Content Types (Yes or No), and Add to Default View (Yes
or No). Person or Group—
Has the following options: Description (text), Default Value (Yes or
No), Require That This Column Contains Information (Yes or No), Allow
Multiple Selections (Yes or No), Allow Selection Of (People Only,
People, and Groups), Choose From
(All Users, SharePoint Group), Show Field (ID, Name, Modified, Created,
Account, Email, Mobile Number, SIP Address, Department, Job Title, Name
[with Presence], Name [with Picture], Name [with Picture and Details],
Content Type), Add to All Content Types (Yes or No), and Add to Default
View (Yes or No). Hyperlink or Picture—
Has the following options: Description (text), Require That This Column
Contains Information (Yes or No), Format URL As (Hyperlink, Picture),
Add to All Content Types (Yes or No), and Add to Default View (Yes or
No). Calculated (calculation based on other columns)—
Has the following options: Description (text), Formula, Insert Column
(shows valid columns to add to the formula), The Data Returned from This
Formula Is (Single Line of Text, Number, Currency, Date and Time,
Yes/No), Add to All Content Types (Yes or No), and Add to Default View
(Yes or No). External Data—
Has the following options: Description (text), Require That This Column
Contains Information (Yes or No), External Content Type, Select the
Field to Be Shown on This Column, Display the Actions Menu (Yes or No),
Link This Column to the Default Action of the External Content Type (Yes
or No), Add to All Content Types (Yes or No), and Add to Default View
(Yes or No).
Managed Metadata—
Has the following options: Description (text), Require That This Column
Contains Information (Yes or No), Enforce Unique Values (Yes or No),
Add to All Content Types (Yes or No), Add to Default View (Yes or No),
Allow Multiple Values (Yes or No), Display Value (Display Term Label in
the Field or Display the Entire Path to the Term in the Field), Use a
Managed Term Set (Find and Reset buttons) or Customize Your Term Set,
Allow Fill-in Choices (Yes or No), and Default Value (Browse button).
With this wide range of
choices, it should be obvious that an incredible number of combinations
can be created to meet business needs. This chapter provides examples of
several different column types, but an administrator should become
familiar with the capabilities of the different columns through
experience and trial and error and by taking the effort to meet specific
end-user and business requirements through lists and libraries.
Caution
Keep in mind that some
restraint should be used when creating more complex lists and libraries
that involve dozens or even hundreds of columns. Microsoft offers a
white paper titled “DesigningLargeListsMaximizingListPerformance.docx”
that provides information about topics such as row wrapping, lookup
columns, and indexes that should be reviewed for more complex designs.
For example, it is not unusual for an organization to want to move away
from a very complex Excel spreadsheet and leverage a SharePoint 2010
list instead. Some spreadsheets have hundreds of columns in one
worksheet, and although a SharePoint 2010 list can replicate this
design, this can result in the SQL database requiring multiple rows to
store the data. For example, if there are more than eight date and time
columns in a list, each item will use two SQL Server database table
rows. If there are more than 16 date columns, each item uses 3 rows.
According to the Microsoft document, the performance impact in larger
lists is in the range of 35 percent per additional row. So, this
document is recommended reading for SharePoint architects and
administrators who are tasked with more daunting list designs involving a
large number of columns.
An Introduction and Practical Application of Calculated Columns
Calculated columns are
enticing and powerful, but can be frustrating to use without some
background. A starting rule of thumb is this: If it works in Excel, it
will probably work in SharePoint. SharePoint, unfortunately, has a wide
range of restrictions when compared to Excel, so this rule should be
understood with a dose of healthy skepticism.
Some important rules and guidelines are as follows:
Arithmetic operators
supported include + (addition), - (subtraction), * (multiplication), /
(division), % (percent), and ^ (exponentiation). Parentheses are supported in equations. Comparison
operators supported include = (equal to), > (greater than), <
(less than), >= (greater than or equal to), <= (less than or equal
to), and <> (not equal to). & (ampersand) connects two values to produce one continuous text value. Lists and libraries do not support the RAND and NOW functions. The TODAY and ME functions are not supported in calculated columns but are supported in the default value setting of a column. You cannot reference a value in a row other than the current row. You cannot reference a value in another list or library. Many Excel functions are supported in SharePoint calculated columns, but testing should be performed to verify functionality.
An example is as follows
that adds a calculated column to see whether the profit on an item
exceeds the goal of a 10 percent profit. A new list is created and
several columns added to it, one of which is a calculated column. Then
some sample items are added to the list and the calculated column works its magic to determine whether the Sell Price exceed a 10 percent profit:
1. | Create a new list using the Custom List template and name it CalculatedColumnTest.
| 2. | From the CalculatedColumnTest list, click the List tab, and then click List Settings.
| 3. | Scroll down and click the Create Column link.
| 4. | Name the new column Cost and check Currency; leave the other settings and click OK.
| 5. | Scroll down and click the Create Column link once more.
| 6. | Name the new column Sell Price and check Currency; leave the other settings and click OK.
| 7. | Scroll down and click the Create Column link a third time.
| 8. | Name the new column Meets Profit Goal and check Calculated.
| 9. | Scroll down to the Additional Column Settings section, and enter the following formula:
=IF(Cost>([Sell Price]-(Cost*(10/100))),"No","Yes")
The IF function is described in more detail in Excel 2010 help, and the
syntax is the same in a SharePoint 2010 calculated column. A translation
of the syntax is “IF(logical_test, [value_if_true], [value_if_false]).”
In the case of the formula used in this example, this translates to “If
the Cost is greater than the Sell Price minus 10 percent of the Cost,
display the value No; if not, display the value Yes.”
| 10. | Verify that Single Line of Text is checked below the formula; then leave the other settings at their defaults. Click OK.
| 11. | Click CalculatedColumnTest from the breadcrumb to return to the All Items view of the list.
| 12. | Click Add New Item.
| 13. | Enter a title for the entry, such as Widget, and enter 20 in the Cost field, and enter 22 in the Sale Price field, and click OK.
| 14. | Click Add New Item a second time.
| 15. | Enter a title for the entry, such as Gadget, and enter 40 in the Cost field, and enter 43.99 in the Sale Price field, and click OK.
| 16. | Click Add New Item a third time.
| 17. | Enter a title for the entry, such as Mousetrap, and enter 60 in the Cost field, enter 66 in the Sale Price field, and click OK.
| 18. | The results will look like Figure 1.
This makes it very easy for a manager to glance at the list and see
whether items are being sold at an acceptable level of profit.
|
Tip
Additional guidance and information is available by accessing SharePoint help and then entering introduction to data calculations in the Search field.
|