I frequently receive requests for displaying contents of a list in an A-Z index of sorts where items also need to be grouped by the first character in their title or name or some other value. I know there are different ways of solving this. This post provides a "crude" way of satisfying this request using Calculated columns.

Let's say that the Title column is the one that needs to be sorted alphabetically. I then create a calculated column (for our example, we're going to name it IndexCode) and I use the formula:

        code([Title])

This returns the code for the first character in the string contained in the Title column. In some cases, that's all I need. However, since this formula returns a numeric value (65 for A, 66 for B, 67 for C, and so forth), it might not be useful when you need to display it on a page. So my next step is to convert that number back to a character. For this, I created yet another calculated column (continuing with our example, we're going to call Index) and this time I use the following formula:

        char([IndexCode])

This formula returns the character specified by the code number in the IndexCode column (A for 65, B for 66, C for 67, etc.). Now I can use this one in, for example, Content Query Web Parts for grouping my items.


Lastly, users may not care for typing things in upper case. If this is something you may want to use for your index, you may want to use the upper([ColumnName]) formula.



For more formulas that you can use in SharePoint, you may want to visit this other web site.
 
One request we frequently receive is to allow to colour events in a Calendar list for easier finding and viewing. Path to SharePoint offers a script that you may want to check. And that's basically what I did; didn't feel like reinventing the wheel. So go here and follow the instructions. If you have any questions about the original site, contact Christophe@PathToSharePoint.com

But before you start, make sure you have the following:

- Calendar list ready to be used
- A choice column of your preference, which will be use to categorize the events on your Calendar list
- A displayed column already designated (for example, Title)
- A separate Colour column (calculated value)
- Another calculated value column (for example, ColouredEvent)

Follow the instructions on that site and you should be all set. If you have any doubts, I can assure you we were able to successfully implement this solution on SharePoint 2010.

It might get a little bit tricky when you have to create the view that will display the colour-coded events. If you don't pick the right columns, it won't work. Find below a sample image of how the Calendar view should be set up.



The final thing you will need is to reference the script from the page where you are displaying the coloured view of the Calendar list. To do so, upload the script to a document library, go back to the page where your calendar view displays, edit it to insert a Content Editor Web Part (CEWP), and reference the script file from the CEWP). Save and publish the page. It should work.
 
It is not unusual that customers will ask for list filters to be created. While many users who are used to SharePoint would probably use the column headers to filter, not all users are SharePoint savvy and that's how I get those requests.

This solution will show how to create an alternative for those cases when customers want something looking more like a regular Web page and not like a SharePoint list.

The elements I usually use for this solution are:
    - Filters (Blank Web Part) page
    - Custom list with the information to be filtered
    - HTML Form Web Parts, one per needed filter
    - HTML custom code
    - Data Connections

Step 1 - Create Custom List

For the sake of time, I'm going to assume you have your custom list already created, including views and everything else. In my example, I'm going to be using a very simple list that tracks people on duty for three available shifts (morning, afternoon, and evening).

Step 2 - Create Filters Blank Web Part Page

In SharePoint, go to the Pages library and create a Blank Web Part Page and name it Filters or anything else that might better suit your needs.

Step 3 - Add HTML Form and List Web Parts to the Filters Page

Edit the Filters page and add one HTML Form web part for each filter you are going to be needing plust the Clear All Filters button within the web part zone or zones of your choice. Add the custom list view web part somewhere on the page, as well. And don't forget to edit the list web part to apply the list view of your choice.

I don't like the web part chromes, or their titles. So I usually remove all those settings and I add Content Editor Web Parts right above or next to the HTML Form Web Parts to include meaningful text for my users and I format the text to my needs. So feel free to do so, as well.

Step 4.a - Provide Appropriate HTML Code - Clear All Filters

Edit the HTML Form Web Part that will be acting as the Clear All Filters button.

Select [Source Editor...] at the Form Content Editor section of the web part tool pane. This is how the code usually looks:

<div onkeydown="javascript:if (event.keyCode == 13) _SFSUBMIT_"><input name="T1"/><input value="Go" onclick="javascript:_SFSUBMIT_"/></div>

 
One comment about this code. I don't know in your experience, but in mine, many users do not really understand what 'Go' means. So for this reason, I always prefer to change that to either Clear All Filters, or Apply Filter depending on my situation. So in this case, it is going to be renamed to Clear All Filters. And I also modified the rest of the code to look like this:

<div style="text-align: left">
<input onclick="location.href=&#39;https://SiteURL/Pages/Filters.aspx&#39;" value="Clear All Filters"/>
</div>

(Note: If the code above gives you trouble, see the note added on August 2012 at the bottom of this post)


If you would prefer a different alignment, replace left with either right, or center. Replace SiteURL in the code above to the full path to your Filters page. Save the web part. This code will simply "refresh" the page to make it look like the list has been cleared of all filters when selected (clicked).

Step 4.b - Provide Appropriate HTML Code - By Person

Edit the HTML Form Web Part that will be acting as the first of your filters; in our example, the first filter will be used to filter the list based on person name. Select [Source Editor...] at the Form Content Editor section of the web part tool pane and replace the code with the following,

<left>
<div onkeydown="javascript:if (event.keyCode == 13) _SFSUBMIT_">
<select name="Title">
<option value=""></option>
<option value="Anne">Anne</option>
<option value="Jane">Jane</option>
<option value="Mary">Mary</option>
<option value="Susan">Susan</option>
<option value="Tim">Tim</option>
</select>
<input type="button" value="Apply Filter" onclick="javascript:_SFSUBMIT_"/></div>
</left>

If you would prefer a different alignment, replace left with either right, or center.

Since I used the Title column to save the names on my list, this is the value I input where it reads select name, even when I renamed that column to Name. It is important to point out that the code will only work with the internal name of the column.

The first option value remains with no option for when nothing has been selected, yet. Replace the rest of the values and add or remove lines to matching your needs.

Save the web part.

Step 4.c - Provide Appropriate HTML Code - By Shift

Repeat all the steps in section 4.b and replace the code with the following,

<left>
<div onkeydown="javascript:if (event.keyCode == 13) _SFSUBMIT_">
<select name="Title">
<option value=""></option>
<option value="Morning">Morning</option>
<option value="Afternoon">Afternoon</option>
<option value="Evening">Evening</option>
</select>
<input value="Apply Filter" onclick="javascript:_SFSUBMIT_"/></div>
</left>

Make changes as appropriate to match your needs and save the web part.

Step 5 - Establish the Data Connections

This is where people may differ on how to proceed. Some people use SharePoint Designer to establish the data connections. However, for simple data connections like the ones in this example, you may establish them within SharePoint itself. And that's what I'm going to explain in the next lines.

Edit the first HTML Form Web Part (By Person). Select Connections > Provide Form Values To > Daily Schedule (or the name of your list).


SharePoint displays the Choose Connection web page dialog. In the 1. Choose Connection tab, select Get Filter Values From at the Connection Type drop-down list and then select [Configure].

SharePoint switches to the 2. Configure Connection tab. Select the Provider Field Name (for our example, that would be Title) and the Consumer Field Name (For our example, Name) from the respective drop-down lists and then select [Finish].


Edit the second HTML Form Web Part (By Shift). Select Connections > Provide Form Values To > Daily Schedule (or the name of your list).

SharePoint displays the Choose Connection web page dialog. In the 1. Choose Connection tab, select Get Filter Values From at the Connection Type drop-down list and then select [Configure].

SharePoint switches to the 2. Configure Connection tab. Select the Provider Field Name (for our example, that would be Title) and the Consumer Field Name (For our example, On Duty) from the respective drop-down lists and then select [Finish]

Save the page. Test the filter buttons. If everything looks satisfactory, check the page in (and publish it if publishing is turned on for your site).

This is how my page looks like now:



If I apply the By Person filter for 'Anne,' this is how it looks:



And this is how it looks if I apply both By Person = Anne and By Shift = Morning.


Note: When teaching your site users how to apply these filters, you will need to point out that they will need to select [Apply Filter] for all the filters they would like to apply, one at a time.


UPDATED January 2013: I had some problems reusing the code for the Clear All Filters button at a different customer. I had to swap some things around and this is the resulting code, which you can try if you are experiencing problems, as well:

<div onkeydown="javascript:if (event.keyCode == 13) _SFSUBMIT_"><input type="button" value="Clear All Filters" onclick="location.href=&#39;https://SiteURL/Pages/Filters.aspx&#39;"/></div>


Bonus: Code for ABC Filter

    <div onkeydown="javascript:if (event.keyCode == 13) _SFSUBMIT_">
    <select name="IndexChar">
    <option value=""></option>
    <option value="A">A</option>
    <option value="B">B</option>
    <option value="C">C</option>
    <option value="D">D</option>
    <option value="E">E</option>
    <option value="F">F</option>
    <option value="G">G</option>
    <option value="H">H</option>
    <option value="I">I</option>
    <option value="J">J</option>
    <option value="K">K</option>
    <option value="L">L</option>
    <option value="M">M</option>
    <option value="N">N</option>
    <option value="O">O</option>
    <option value="P">P</option>
    <option value="Q">Q</option>
    <option value="R">R</option>
    <option value="S">S</option>
    <option value="T">T</option>
    <option value="U">U</option>
    <option value="V">V</option>
    <option value="W">W</option>
    <option value="X">X</option>
    <option value="Y">Y</option>
    <option value="Z">Z</option>
    </select>
    <input value="Apply Filter" onclick="javascript:_SFSUBMIT_"/></div>
    </left>


 
We have used the formula below to concatenate information such as document name and version, or to create unique IDs in SharePoint.

1. Create a Calculated value column

2. Use the formula below,

        =CONCATENATE([ColumnName1],[ColumnName2])

Note:
Replace the generic ColumnName1 and ColumnName2 in the example above with the name of your respective columns.
 
Once in a while we get a customer who wants us to remove the checkboxes that display at the top on a list view web part.

This can be accomplished within SharePoint 2010 itself and by modifying the applicable list view.

Modify the list and locate the Tabular View section near the bottom. Expand this section and clear the Allow individual item checkboxes option.


Note: After modifying the view, you may need to reapply the view at the web part level on the page where it displays. Sometimes this type of changes are not immediately reflected on the pages, if never. So you have to force the change to go through, in which case you need to edit the page, edit the web part, and select the view at the Select View drop-down list within the List View section of the web part editing tool pane.