130 likes | 198 Views
Learn about the HTML Calculated Field in SharePoint, a powerful tool that allows you to build conditional HTML strings for various data types like status, numbers, percentages, and more. Discover how to use JavaScript to render HTML content and get ideas for practical applications, such as creating dashboards and highlighting list items. With no installation required, this customizable feature is beneficial for businesses to create dynamic KPIs across different versions of SharePoint.
E N D
The HTML Calculated Field • What is it? • How do you use it? • What can it do for me? • Ideas! • More Info?
The HTML Calculated Field • Is a Standard OTB Calculated Field • Comes with both WSS 3 & MOSS • Requires No Installation (Great for Hosting) • So… How do you use it?
The HTML Calculated Field • Use it to “Build” Conditional HTML Strings • You can set conditions based on: • Status • Numbers • Percentages • Dates • …Essentially anything you can test for, you can build a HTML Calculated Value to represent it. • Problem is, the HTML gets parsed and rendered as text, Right? Yes… until you add this bit of JavaScript!
The HTML Calculated Field • <script type="text/javascript"> • /* • Text to HTML - version 2.0 • Questions and comments: Christophe@PathToSharePoint.com • */ • function TextToHTML(NodeSet, HTMLregexp) { • var CellContent = ""; • var i=0; • while (i < NodeSet.length){ • try { • CellContent = NodeSet[i].innerText || NodeSet[i].textContent; • if (HTMLregexp.test(CellContent)) {NodeSet[i].innerHTML = CellContent;} • } • catch(err){} • i=i+1; • } • } • // Calendar views • var regexpA = new RegExp("\\s*<([a-zA-Z]*)(.|\\s)*/\\1?>\\s*$"); • TextToHTML(document.getElementsByTagName("a"),regexpA); • // List views • var regexpTD = new RegExp("^\\s*<([a-zA-Z]*)(.|\\s)*/\\1?>\\s*$"); • TextToHTML(document.getElementsByTagName("TD"),regexpTD); • // Grouped list views • ExpGroupRenderData = (function (old) { • return function (htmlToRender, groupName, isLoaded) { • var result = old(htmlToRender, groupName, isLoaded); • var regexpTD = new RegExp("^\\s*<([a-zA-Z]*)(.|\\s)*/\\1?>\\s*$"); • TextToHTML(document.getElementsByTagName("TD"),regexpTD); • }; • } • )(ExpGroupRenderData); • </script>
Ideas – Project Status Dashboard This is a CQWP Rollup
Ideas – Highlighting List Items From This… To This… Bold Mgr’s Name
The HTML Calculated Field • Benefits • Easy to change • No Developer Required • 0 Impact to SharePoint • No Upgrade issues • Business can create the Formulas (they’re just like Excel) • Gives you the ability to add KPI’s to any SharePoint Version
The HTML Calculated Field • More Information: • HTML Calculated Field – Where it all began • Christophe’s Site - http://pathtosharepoint.wordpress.com • HTML Calculated Field - The original article • Example on building a Project Status Dashboard • My Blog – http://sharepointblog.spaces.live.com • Assets – http://skydrive.live.com • Tooltip Bubbles • Alessandro Fulciniti – http://web-graphics.com