You are currently browsing the monthly archive for May 2010.
This series assumes that you are familiar with the “HTML Calculated Column” .
Part I: fallback to SP 2007
Part II: edit in SharePoint Designer
In this part II, I am going to show a straightforward method that can be applied via SharePoint Designer.
In SharePoint 2010, lists are rendered through a new component, the XSLT List View (XLV) .
Let’s add to a page a list with an HTML Calculated Column. Naturally, this column will be rendered as text. If we edit the page in SharePoint Designer, in split mode, it will look like this (click picture to enlarge):
The XSLT hierarchy is displayed at the bottom of the page. The tag that renders the field reads as follows:
<xsl:value-of select="$thisNode/@*[name()=current()/@Name]">
This is a complicated expression, but for our purpose we don’t need to understand it. What we are going to do is tell SharePoint to interpret the field as HTML instead of just text, by adding the disable-output-escaping attribute (see picture below):
<xsl:value-of select="$thisNode/@*[name()=current()/@Name]" disable-output-escaping="yes">
And here we go, the field is now rendered as HTML:
The final result in the browser:

Note that the HTML rendering is done in the XSLT view itself. So if you have asynchronous updates enabled, all content refreshes will be rendered as HTML.
How about SP 2007?
We’ve actually already used this method before, in cross-list views:
- with Content Query Web Parts, as demonstrated by Eric Proshuto
- with Data View Web Parts, in my KPI roll-up series
Dealing with a standard Data View Web Part is more difficult, as explained here.
Conclusion: the HTML Calculated Column plays better with the XSLT List View in SP 2010 than it did with the Data View Web Part in SP 2007.
Your feedback and suggestions are welcome, they will guide me in my investigations. Also, let me know if you need more details on the step shown in this post.
This series assumes that you are familiar with the “HTML Calculated Column“.
The “HTML Calculated Column” is a powerful method that I created for SharePoint 2003 and 2007. It allows you to display in your SharePoint lists any kind of HTML: color coded text, inline charts, tooltips, embedded videos, etc.
It works in two steps:
1/ Build a HTML string, using a calculated column
2/ Render this HTML string as HTML in SharePoint pages
I am receiving more and more requests from readers who want to use it in SharePoint 2010. As I explained in a previous post, step 2 is tricky in SP 2010, due to asynchronous updates.
At this point, I don’t have a perfect answer, but I figured I’d just start sharing what I have so far. Expect this to be a long series, where I’ll publish updates as and when I validate more options. Your feedback and suggestions will be essential to guide me in my investigations.
For this first post, let’s start with an easy one. In SP 2010 you can disable asynchronous updates for lists:
- Edit Web Part
- uncheck all the AJAX options:

With the AJAX options disabled, the view will behave like it did in SharePoint 2007, and the Text to HTML script will work (well, you tell me…).
A new addition to the SharePoint User’s Toolkit: a Tasks Lists Roll-up Web Part. When placed on a SharePoint 2007 page (wss or MOSS), this Web Part will aggregate tasks from the current site and all its sub-sites.
After downloading the Web Part, you can add it to your page via the page import option, or include it in your Web Part gallery. This is a regular Data View Web Part, and you can later modify the layout in SharePoint Designer. Without SPD, you could also tweak it directly through the SharePoint UI, or even via a text editor.
Lists roll-ups are available OOTB in SharePoint, thanks to the Data View Web Part – no need for a Content Query Web Part (MOSS only) or third party tools. However setting a DVWP to work in CrossList mode is not easy, even for experienced SharePointers. Hopefully this preconfigured Web Part will give a jumpstart to your cross-list experience.
I’ll publish more explanations in the days to come. I also plan to add more options in the future, as well as roll-ups for other lists - feedback and suggestions are welcome!
In case of emergency
If your customizations break your page, keep in mind the contents=1 trick (explained for example at the end of this article).
This week, Mark Miller and I will be hosting our live online workshop series dedicated to calendars. Mark will start on Tuesday (“Create a SharePoint Master Calendar Solution“), and I’ll join him on Wednesday (“Add Color Coding and Tool Tips to Your SharePoint Calendars“) and Thursday (“SharePoint Calendar Resizing and Enhanced Views“).
To give you an idea of what you can expect on Wednesday, see this live demo that showcases two of the solutions I’ll be presenting (hover over an event to display the tooltip):
http://www.pathtosharepoint.com/Lists/May2010/calendar.aspx
On Thursday, we’ll review several solutions to make the calendar month view user friendly:
- Resize a month view
- Switch from week view to month view in a snap
- Display weekdays only
- Hide start time for intraday events
- Skip the “more items” button and display all events
- Display a calendar from another site or site collection
All these solutions work on wss v3 and MOSS, and don’t require any server side installation.
Talk to you soon!

Guest author: Larry Pfaff, Convergys.
I left off explaining how I went from raw data to manipulating views to achieve a table layout with usable results.
Continuing forward I will describe how to achieve this output through the use of Calculated Columns (CC) in a custom list. It’s fairly easy to build a table in a CC with some simple HTML. I built my first test table with some test data and found it worked well. I began interchanging my test data with my list data until I hit a wall. The simple HTML table worked perfectly with test data, but when all my formulas replaced my test data it failed. Initially, I thought my formulas contained errors, but upon further research I found it to be the result of a character length limitation in the CC.
Size Limitation
There isn’t much discussion on the web about the character length limitation of a CC. I actually stumbled upon it without realizing. To troubleshoot this limitation I began to break down my formula into useable chunks. By adding the useable chunks to the CC I could confirm parts of the formula were correct. Once I confirmed all the parts were correct I added them back together, but they failed again! I was receiving the error “The formula contains a syntax error or is not supported.”
I confirmed the formulas were correct piece by piece, but once I put them all together it was no good.
This was very frustrating so I reached out to our SP Admin to inquire why this is happening. He stated something about the formula was too long and I couldn’t use it. Well, I am not one that takes no for an answer. So I began trying to figure out ways to reduce the size of my formula string. This is when I had two ideas for reduction.
- Remove the inline styles and replace with CSS classes
- Go back to breaking the formula into usable chunks, leave them as separate CC’s and use a final CC to pull all the parts together.
This result was very successful. In fact later research I found a single post “Calculated Column Limits (1024 Characters)”.
Now that we have a work around for the size limitation we can discuss the fields and calculations.
My list data was updating twice daily through the use of a macro in an Access database paired with the use of scheduled tasks. Below is the list of fields used in my reporting requirements. The gray highlighted rows in the table below is my raw data automatically updated. Each CC will be described and what calculations were used, when necessary.
| Field Name | Field Type | Function |
| Sr. Executive | Single line of text | Raw data |
| Name – Executive | Single line of text | Raw data |
| Completed | Number | Raw data |
| Not Completed | Number | Raw data |
| Exempt | Number | Raw data |
| Grand Total | Calculated | Total of the 3 above |
| Report | Calculated | not required |
| % Not Comp | Calculated | |
| % Complete | Calculated | |
| % Exempt | Calculated | |
| Progress Totla | Calculated | Display progress bar |
| Table | Calculated | Display table with data |
| Chart | Calculated | Chart Image |
Calculated Columns
Grand Total
Data type returned as Number with Auto decimals places. Simple field returning the summed value of three columns for a specific row.
=SUM([Completed],[Not Completed],[Exempt])
Report - Progress by Executive Data type returned as Single line of text
This is not a required field, but it was useful in providing a navigation method to the source data (numbers/details). Here I used an IF statement to build a hyperlink back to the original excel file stored in a local document library. The excel files were names according to the Sr Executive, making the hyperlink easier to build dynamically.
“Ayers” the first name in the formula had the most line items. The report was so large my Access macro would fail trying to upload data into SharePoint. So I split the report into 3 separate files, this formula takes that into account and links to one of three excel files for Ayers.
="<DIV><a href="http://cvgsharepoint/sites/learning/DataSecurityPrivacy/Data%20Privacy%20and%20Security%20Status%20-%2520"&IF([EXEC%20Select]="Ayers,Andrea%20J",IF(OR(Name="Frank%20J%20Corso",Name="Victoria%20Perez%20Mueco"),[EXEC%20Select]&"-New",IF(OR(Name="Steve%20M%20Heffron",Name="Sukant%20Srivastava"),[EXEC%20Select]&"-New",[EXEC%20Select]&"-New")),[EXEC%20Select])&".xls' title='Report Details for "&[EXEC Select]&"' target='_blank'>Report Status Details - "&[EXEC Select]&".xls</a></DIV>"

figure 2.1
The next three formulas are just calculating a percentage for that value
% Complete
Data type returned as Number with 2 decimals places.
=ROUND(([Completed]/[Grand Total]),2)
% Not Comp Data type returned as Number with 2 decimals places.
=ROUND(([Not Completed]/[Grand Total]),2)
% Exempt Data type returned as Number with 2 decimals places.
=ROUND(([Exempt]/[Grand Total]),2)
Progress Total
Another Idea came from a progress bars and adding color.
Currently this CC totals [% Complete] and [% Exempt] as total progress. Because some new employees and upper management were exempt from taking the course Exempt could not count against the total. .
This formula worked perfectly in IE, but I found it to fail in Firefox (FF). I tried multiple changes, but still no success. Christophe brought to my attention I was missing the non breaking space discussed in this post Progress bar + color coding. Now it made sense why it wasn’t working correctly in FF. I made the simple change and confirmed no visual difference between both IE and FF. This is the resulting formula:
="<DIV style='position:relative;'> <div style='background-color:#ccccff;'> <div style='background-color:#0000ff; width:"&(([% Complete]+[% Exempt])*100)&"%;'> </div> <div style='position:absolute;top:0px;color:white;font-weight:bold;padding:0 0 0 2px;'>"&TEXT(([% Complete]+[% Exempt]),"0%")&"</div> </div></DIV>"

figure 2.2
Table This formula is a simple table with some added styles and nested CCs. Styles and nested CCs were used to help with the character length limitation by minimizing total string length. A few trial and errors later and a successful table output. This formula was tested in both IE and FF with success. This is the resulting formula:
="<div><b>Sr. Exec.: </b> "&[Report]&"<table class='myboxed'><tr><th colspan='2'><b>Exec.:</b> "&[Name]&"</th><th class='twidth'>Completed</th><th class='twidth'>Not Completed</th><th class='twidth'>Exempt</th><th class='twidth'>Total</th></tr> <tr style='text-align:right'><td rowspan='2'>"&[Chart]&"</td><td class='label'>Number</td><td class='comp'>"&[Completed]&"</td><td class='nc'>"&[Not Completed]&"</td><td class='e'>"&[Exempt]&"</td><td>"&[Grand Total]&"</td></tr> <tr style='text-align:right'><td class='label'>Percentage</td><td class='comp'>"&[% Complete]*100&"%</td><td class='nc'>"&[% Not Comp]*100&"%</td><td class='e'>"&[% Exempt]*100&"%</td><td></td></tr> <tr><td colspan='6' style='text-align:left;'>"&[Progress Total]&"</td></tr></table></div>"
Note: the styles used for the above classes will be provided later.
Chart
Data type returned as Single line of text. There are several types of chart providers. At the time I was developing this I only knew of google charts. This CC was created for 2 purposes. 1. to return the data as a chart and 2. to save on character length and to be shared in the Table field.
="<DIV><img src='http://chart.apis.google.com/chart?cht=p3&chs=150x50&chd=t:"&[% Complete]&","&[% Exempt]&","&[% Not Comp]&"&chl=Comp|Ex|NC&chco=0000FF'/></DIV>"

figure 2.4
Conclusion
Although we are not quite finished we are well on our way. In Part I we discussed the process that lead me to the table layout and styles described. In Part 2 we discussed some obstacles and work rounds to get the required results. In our final installment, Part 3, I will describe the CSS and scripts that provided the final presentation.
Update [06/07/2010]: screenshots updated.




SocialVibe