O'Reilly logo

SharePoint 2010 at Work by Mark Miller

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The IFs

“If I’m hungry, I’ll eat.”

Basic human survival, we need to eat to survive. Am I hungry: yes or no? If yes, I’ll eat. If no, I won’t eat.

This is the most basic of IF tests, since it deals with a single question that will have one of two possible answers:

If hungry = true, result = eat
If hungry = false, result = don’t eat

SharePoint translation:

=IF([Hungry]=”True”,”Eat”, ”Don’t Eat”)

We’ll test this by creating a custom list with two added columns. The first column is named Hungry, the type of information is Choice, and choices are displayed using Radio Buttons (see Figure 8-1).

First column

Figure 8-1. First column

The second column, shown in Figure 8-2, is named Result, and the type is Calculated with the following formula:

=IF([Hungry]=“True”,“Eat”,“Don’t Eat”)
Second column

Figure 8-2. Second column

Once we have our columns, create a new item on the list, as shown in Figure 8-3.

New list item

Figure 8-3. New list item

The results are shown in Figure 8-4.

Results view

Figure 8-4. Results view

Since we chose True for the answer to whether or not we were hungry, the result displayed is “Eat.”

Now go back and edit the item, but choose False this ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required