Update [6/8/2009]: A new version of the script is now available, more details here.
Updates
I am now expanding the scope of this method:
- list views (flat views and expanded grouping): this article
- list views (collapsed grouping): this article
- display forms (DispForm.aspx): published on 10/01/2008
- calendar views: published on 11/15/2008
- using calculated columns to write scripts: published on 2/26/2009
- preview panes: added on 7/9/2009
- filters: not published yet
Also note the troubleshooting section.
Update [09/10/2008]
I have added a few lines to the initial script to address the case of collapsed views. Also, see my note at the end of this post.
Your feedback is important to me. Big thanks to Fernando, Jeff and the others who reported the limitations of the initial version!
A technical note: considering that 1/ the script is generic and 2/ it may still evolve in the future, a good practice is to store it in a separate text file on your site. You can then link to it from any Content Editor Web Part by using the “Content link” box.
I have already introduced calculated columns in a previous post.
One of their limitations is that the output is just text. Sometimes your browser will be smart enough to interpret the text as a hyperlink – when you calculate an e-mail address or a URL for example. Nevertheless in this case the display is usually not user-friendly. This will never allow you to get what a “Hyperlink or Picture” column does, for example.
To extend the possibilities of calculated columns, my idea is to use them to write HTML instead of just text, thus allowing some additional formatting. In this post I am going to show how to achieve this result through a generic method, combining calculated columns and the Content Editor Web Part.
Let’s start with a simple example based on a contacts list (I’ll provide more advanced examples in my next posts). For each team member, I store the first name, last name and job title. On my site home page, I want to display the list of contacts as “First name Last name”, and display the managers’ name in bold. It would look like the first column below:

A calculated column will easily give me the display name:
=CONCATENATE([First Name],” “,[Last Name])
But I have no option in the SharePoint UI to highlight the managers’ name.
So let’s apply my idea, and use calculated columns to write HTML instead of simple text.
The initial formula becomes:
=CONCATENATE(“<DIV>”,[First Name],” “,[Last Name],”</DIV>”)
I can now add my condition: if the job title contains the word “manager”, add bold style. In SharePoint, this translates as:
IF(ISERROR(SEARCH(“manager”,[Job Title],1)),”style=’font-weight:bold;’”,” “)
So here is my complete formula:
=CONCATENATE(“<DIV”,IF(ISERROR(SEARCH(“manager”,[Job Title],1)),” “,” style=’font-weight:bold;’”),”>”,[First Name],” “,[Last Name],”</DIV>”)
Let’s take a look at our list:

We now have the correct HTML…except that SharePoint is displaying it as simple text. We need to add a short script to change it into HTML.
So let’s add a CEWP to the bottom of our Web Page (how?), and paste the following script in the source editor:
<script type="text/javascript">
//
// Text to HTML
// Feedback and questions: Christophe@PathToSharePoint.com
//
var theTDs = document.getElementsByTagName("TD");
var i=0;
var TDContent = " ";
while (i < theTDs.length) {
try {
TDContent = theTDs[i].innerText || theTDs[i].textContent;
if ((TDContent.indexOf("<DIV") == 0) && (TDContent.indexOf("</DIV>") >= 0)) {
theTDs[i].innerHTML = TDContent;
}
}
catch(err){}
i=i+1;
}
//
// ExpGroupRenderData overwrites the default SharePoint function
// This part is needed for collapsed groupings
//
function ExpGroupRenderData(htmlToRender, groupName, isLoaded) {
var tbody=document.getElementById("tbod"+groupName+"_");
var wrapDiv=document.createElement("DIV");
wrapDiv.innerHTML="<TABLE><TBODY id=\"tbod"+ groupName+"_\" isLoaded=\""+isLoaded+ "\">"+htmlToRender+"</TBODY></TABLE>";
var theTBODYTDs = wrapDiv.getElementsByTagName("TD"); var j=0; var TDContent = " ";
while (j < theTBODYTDs.length) {
try {
TDContent = theTBODYTDs[j].innerText || theTBODYTDs[j].textContent;
if ((TDContent.indexOf("<DIV") == 0) && (TDContent.indexOf("</DIV>") >= 0)) {
theTBODYTDs[j].innerHTML = TDContent;
}
}
catch(err){}
j=j+1;
}
tbody.parentNode.replaceChild(wrapDiv.firstChild.firstChild,tbody);
}
</script>
Now the browser displays the strings as HTML, and my list looks like the initial screenshot at the top of the page!
A couple notes:
- The script identifies the to-be HTML by the opening tag <DIV and the closing tag </DIV>.
- I have tested the script in Internet Explorer and Firefox.
- Remember to drop the CEWP after all the views you want to change. You can for example put it at the bottom of the page.
In my next posts, I’ll show various examples involving styles, pictures and links. If you have a specific issue, feel free to submit it!
How about the Data View Web Part?
Of course such customizations could also be done through the DVWP. I am not going to detail this here, feel free to contact me for specific questions.
As I already mentioned, if I can reach the same result with either the CEWP or the DVWP, I’ll favor the CEWP as 1/it is a safer approach 2/the changes can easierly be undone and 3/it doesn’t require SharePoint Designer.
A note for the SharePoint experts
On SharePoint pages, scripts can be called by a function named “_spBodyOnLoadFunctionNames”. This allows for a timely execution of the script, on page load.
In this case, I am not using it, as we want the script to run before the page can be viewed by the users. Are there any side effects of not using _spBodyOnLoadFunctionNames? Advice on this is welcome!
- browser other than IE or Firefox on Windows
- non-Windows environment
- scalability (long lists, use across multiple lists)
- specific use cases, with formulas you have written yourself
- coexistence with other code or customizations (DVWP, etc.)
Feel free to leave a comment or contact me: Christophe@PathToSharePoint.com

143 comments
Comments feed for this article
September 1, 2008 at 5:15 pm
EndUserSharePoint.com: How to create links, labels and coloring in a SharePoint list : End User SharePoint
[...] are many people who want to be able to create HTML within a list cell in SharePoint. Using calculated columns to write HTML is a step-by-step process for doing [...]
September 5, 2008 at 8:54 pm
Fernando Gonzalez
Chris,
Script works great, I just have one question.
When I make the list look ok all the font formating I do with HTML, but if I make a grouping withing that list I loose the HTML formating and it dispays simple text again (like not having the scrip)
Do you know why? Can I solve this?
Thanks
September 6, 2008 at 1:26 pm
Christophe
Good point Fernando. The current script only runs on the items present when the page is initially loaded (whether they are visible or not).
In SharePoint 2003, all items are pulled when the page loads, so the script will work for both collapsed and expanded groupings.
In SharePoint 2007, the script only works for expanded groupings. For collapsed views, the items are only pulled later, on request (when the user expands a group), and they won’t be converted into HTML.
Let’s see if we can improve this… suggestions are welcome!
September 7, 2008 at 3:10 am
Fernando Gonzalez
Thanks for the quick answer.
I guess I’ll need to find another way of doing it.
September 8, 2008 at 4:21 am
Christophe
[Update] Several readers have reported the limitation with collapsed views in SharePoint 2007, and I have sent them a solution for this specific case. I’ll wait for their feedback before I publish the updated script.
September 10, 2008 at 9:30 am
Christophe
I have now posted the updated script. Waiting for your feedback!
September 11, 2008 at 3:10 pm
Ben Bradley
Hey Christophe,
Thanks for posting this gem! I tweaked it a bit in order to make it work on a calendar view too. I had problems getting it to work across views (day, week, month) properly until I had the idea to change the theTDs array from loading with TD tag data to loading A tag data. This preserves the link and allows the native CSS to work … mostly.
You can see my writeup on it here: http://moblog-banditben.blogspot.com/2008/09/sharepoint-calender-colorification.html
September 12, 2008 at 9:03 am
DL
Hi Christophe,
I did a try on the above. I create a task library with the columns setup as above. Then I added in a Content Editor Web Part with the script above inside. The CEWP was placed just right below the task table but hidden.
However, nothing happen. The browser didn’t displays the strings as HTML and I still see … from the column.
Could I know how to make the formular in Calculate Column as HTML?
Thank you.
September 12, 2008 at 9:30 am
Christophe
DL, feel free to send me more details (maybe a screenshot and a copy of your CEWP content) by e-mail: Christophe@PathToSharePoint.com.
If you say you followed the steps, I don’t see why it wouldn’t work…
September 12, 2008 at 9:34 am
Christophe
@ Ben: thanks for the comments and for sharing your solution
September 12, 2008 at 10:12 am
DL
Hi Christophe,
Thanks it works finally. Would like to find out the script above is it just applicable to the above function or it works for any html code written in Calculate Column? As I’m trying out the feature on the color coding (background color). Anything that I need to amend from the script in order to make it works?
Thanks for your advise again.
September 12, 2008 at 10:56 am
Christophe
DL, if you read other posts on this blog you’ll find other examples, and I plan to publish a few more.
How far can we go? I can’t tell. I hope other people will do like Ben and share their findings. On my side, I have for example tried to include simple events in my formulas (onmouseover, onmouseout) and it worked fine.
This method answers many common requests, and I am a proud dad. But let’s not forget it’s just a trick!
September 15, 2008 at 9:46 am
DL
Christophe-It works. I just change the choose() to simple if() statement and it works fine now. Thank you for the codes.
I have 2 more questions.
1) can the calculate column refer to itself? Actually would like to disable the input if column is filled.
2) can we compare same column figures but from 2 different records. Means in the List library, I have 2 records which contain a set of figures (Plan & Actual) and would like to compare the figures.
Thank you.
September 15, 2008 at 12:37 pm
Christophe
1) No, circular references are not allowed
2) No, this is in my list of restrictions:
http://pathtosharepoint.wordpress.com/2008/08/07/calculated-columns/
You’ll have to find another way, for example with SharePoint Designer.
September 16, 2008 at 1:15 pm
Christophe
I have changed the formatting of the post to make the script easier to grab (click on “copy to clipboard”).
September 18, 2008 at 9:46 am
Sam
Thanks for the idea and code.
October 9, 2008 at 1:01 pm
Jazz Up Your SharePoint Dashboards With Graphic Indicators « The WorkerThread Blog
[...] a look at Christophe’s Path to SharePoint blog. Christophe has come up with the idea of using calculated columns to write HTML, within which you can generate coloured bars, traffic-light symbols etc, like [...]
October 29, 2008 at 10:11 am
Gantt view: a first test « Path to SharePoint
[...] post shows a first attempt to use my “HTML calculated column” method to display Gantt [...]
October 30, 2008 at 6:11 pm
MindBusiness Blog » Formatierte Felder und Ampelfunktionen in SharePoint mit JavaScript
[...] http://pathtosharepoint.wordpress.com/2008/09/01/using-calculated-columns-to-write-html/ [...]
November 1, 2008 at 2:37 am
Troubleshooting your “HTML calculated column” « Path to SharePoint
[...] The purpose of this post is to help readers who are having trouble implementing my “HTML calculated column” [...]
November 14, 2008 at 9:48 pm
Jim
What is the limit to the number of nested IF() functions MOSS can handle this way?
November 15, 2008 at 1:30 am
Christophe
Jim: see if you can find your answer here:
http://www.endusersharepoint.com/STP/topic.php?id=345
If not, you may want to post your question over there, as Dessie is very knowledgeable on this topic.
As for me, if you go through this blog you’ll see that when applicable I prefer the CHOOSE function. Start for example with this thread:
http://pathtosharepoint.wordpress.com/2008/09/15/share-your-html-calculated-columns/#comment-247
November 15, 2008 at 9:10 am
SharePoint calendars: color coding, hover effects, etc. « Path to SharePoint
[...] months ago, I introduced a method to display html in list views. The purpose of this post is to extend it to calendar [...]
November 17, 2008 at 9:53 pm
kenny
Great find! I, however, can not get the java code to work properly. I have added it as a Content Editor Web Part and copied your code exactly. I have a column of Priority and the recomended code for the calculated column. The logic is working but the HTMl code is not being read in my view. Can you please give any suggestions? I am running SharePoint Services 3.0. Thank you!
November 17, 2008 at 10:02 pm
Christophe
Kenny, start here and let me know if it helps:
http://pathtosharepoint.wordpress.com/2008/11/01/troubleshooting-your-html-calculated-column/
November 17, 2008 at 10:13 pm
kenny
I have even tried your basic manager example with no success. I have confirmed that the CEWP is below my View!
November 17, 2008 at 10:21 pm
Christophe
Sorry, it seems that the script was broken after I updated the post today. I have now fixed it and it should work fine.
November 19, 2008 at 3:36 am
Demi
Hi Christopher,
Would like to find out, can we make use of calculate column, to auto assign the permission?
Where I have a Task Library and every task there is a Task Lead, which I’m making use of the field “Assigned To” that auto created by the library. Permission control is applied to the Task Lead. They only have the Edit (Contribute) rights for those task records which are assigned to them.
My question is, is there a way to automate the permission? Means once I add the name of the Task Lead in the field “Assigned To”, sharepoint will automatically give them the Contribute rights for that record. Rather then we have to go into individual records to assign the rights.
Any advise?
Many Thanks
Demi
November 19, 2008 at 3:58 am
Christophe
Sorry Demi, I don’t see an easy way to do it (maybe try workflows?). And I don’t think calculated columns can help here.
November 24, 2008 at 1:04 am
TFForums
I’m trying to highlight a date red if its older than 30 days. I have two calculated columns, thus:
=IF(DATEDIF(Date,Today,”D”)>30,TRUE,FALSE)
=IF(DateHighlight,”"&Date&”",Date)
The First on is Called DateHighlight and just calculates if the date should be higlighted – the 2nd does the highlighting based on the first.
I can get the thing to highlight. However, if this columns type is set to string… all the dates come out with values like 27,203 etc… if i set the type to a date – the non highlighted ones come out as formatted dates – the highlighted ones but the date still comes out as a string.
Is there a way to get the string representation of the formatted date?
November 24, 2008 at 1:30 am
TFForums
sorry – some cut and paste went a bit wrong in my post… basically my problem is the highlighted red dates come out as numbers (37432) with no commas even if the type of the column is set to date. If the type of the column is text then all the dates come out as numbers. Please help.
November 24, 2008 at 3:45 am
Christophe
I’d say you need to build the date format yourself, using the DAY, MONTH and YEAR functions. For example:
=DATE(YEAR([Due Date]), MONTH([Due Date]),DAY([Due Date]))
or:
=MONTH([Due Date])&”/”&DAY([Due Date])&”/”&YEAR([Due Date])
It always gives me the shivers when I see “Today” in a formula… I was wondering if you have read this post:
http://pathtosharepoint.wordpress.com/2008/08/14/calculated-columns-the-useless-today-trick/
November 26, 2008 at 9:44 pm
Compare DueDate with Today in list view « SharePoint JavaScript’s
[...] posts on Using calculated columns to write HTML inspired me to try to workaround the well known SharePoint limitation of not beeing able to use [...]
December 3, 2008 at 6:17 pm
One way to present media with SharePoint - From SharePoint with love
[...] column. This is where it all comes together and the magic that turns the pumkin into a chariot is Christophe's code for "HTML calculated columns". It's a very clever idea and I recommend you all to read his posts on the subject if you [...]
December 5, 2008 at 11:24 pm
Adam
Christophe,
Great serie of posts. really, really useful. I’ve created a contacts list with a calculated field for picture. If I view the list with the “normal” table style, the HTML trick works perfectly. If I change the style of the view to boxed (with labels) the HTML web part seems to change the formatting of all of my other fields so they all run into each other and so are much less useful. Is there anything I can do to change the code to help with this?
Thanks,
Adam
December 6, 2008 at 2:06 am
Christophe
Adam, the boxed view works fine for me, my World Clock demo uses it:
http://8002.freesharepoint2007.com/Lists/WorldClock/AllItems.aspx
So it seems to be specific to your formula.
December 8, 2008 at 7:55 pm
robin
Do you have any tips (non SPD) or html tricks to increase designate column widths within a list?
December 8, 2008 at 11:47 pm
Christophe
Robin: I’ll certainly publish a post about formatting columns in a couple months, but I have nothing ready yet.
What I am going to publish soon is a post about formatting rows (color, hide/display).
December 9, 2008 at 12:44 pm
robin
Great! I am looking forward to all the new content.
December 10, 2008 at 8:59 am
Adam
Christophe, Thanks for the response. My formula is (I think!) pretty simple:
=CONCATENATE(“”)
When I look at the result of the calculated field (without the necessary HTML webpart on the page), it seems to generate the right code. When I add the webpart to any view other than one that is a boxed style view, it works perfectly and renders the picture without impacting on anything else.
When I add it to a boxed view, the picture renders fine, but all of the labels and text in the other fields getconverted to a different font and all run together. I can’t quite se what I’ve done wrong, particularly as you get it to work on your world clocks demo.
I’ve played about with the formula, but just can’t get anything to work. Any suggestions?
Great series, by the way. Giving me loads of inspiriation to try many things!
Thanks,
Adam
December 10, 2008 at 9:03 am
Adam
Sorry, forgot to put my code in the right format. My formula is:
=CONCATENATE("<DIV><IMG src='http://server/sites/CSGC/Pictures/",[Firstname]," ",[Lastname],".jpg' /></DIV>")Thanks,
Adam
December 10, 2008 at 9:14 am
Christophe
Adam: I would first try to replace the blank in the URL with its escaped value “%20″. Also, check if any of the names includes a special character (apostrophe or space for example).
I hope that you’ll share some of your ideas with us!
December 10, 2008 at 4:30 pm
Adam
Christope: I’ve worked out why I’m getting the odd behaviour, but not how to fix it!
In my boxed style view, I was displaying my calculated column as column 1, so it appeared at the top of each entry and Sharepoint was therefore trying to make it link through to dispform.aspx for the individual item (as this is the standard Sharepoint behaviour for the first coumn in a boxed style view). If I move the column down so it appears as column 2 or a later column in my boxed style view, everything works fine! So it must be something to do with placing that calculated column as the first column in the boxed style view. The column works fine when it placed as the first column in any other style of view.
I’m not a coder by any stretch of the imagination
so if you can come up with a fix, that would be great. In the meantime, my work-around is to not make this column 1 (which isn’t too much of a problem)
Cheers,
Adam
December 11, 2008 at 12:14 am
Christophe
Thanks for reporting the issue, Adam. I’ll work on a fix.
December 11, 2008 at 12:00 pm
JQuery for Everyone: HTML Calculated Column | End User SharePoint
[...] important scripts for quickly and easily punching up the List View and List Form web parts, the HTML Calculated Column. His creative uses for this mashup of data and HTML always inspires [...]
December 12, 2008 at 12:59 am
joe
Hi Christophe,
I’ve used your scripts from the HTML Calculated Column article to create a column showing a due date indicator icon.
It works fine in the site where I created the column manually on a site column which was then added to a content type. The content type then added to the list on the site.
When I then save that site as a template (.stp) and try to create a new site from the template I get the error:
The formula refers to a column that does not exist. Check the formula for spelling mistakes or change the non-existing column to an existing column.
I’ve tried everything including renaming all my columns in the Content Types and Site Columns but to no avail.
We are going live with a project next week using these indicators and an event handler that generates a site from the .stp template but we have just tested the template today manually and it fails because of the HTML in the columns. I am in desperate need of your help at the moment.
Is there a workaround for this issue?
Thanks for any help.
May 21, 2009 at 2:21 pm
cg
Joe,
Did you ever get the error “The formula refers to a column that does not exist. Check the formula for spelling mistakes or change the non-existing column to an existing column.” solved.
I have the same problem. My calulated columns work just fine. When I create a site based on that site template, I get the same error mentioned above. However, when I check my newly created site, the columns work fine there as well (at least I think so).
Any guidance would be appreciated. Thanks!
December 16, 2008 at 3:10 am
Christmas indicators « Path to SharePoint
[...] final step is to add the usual script to the page. That’s it! See the live demo here: [...]
December 18, 2008 at 10:55 pm
Adam
Can you use javascript using this code?
December 19, 2008 at 12:50 am
Christophe
Adam: this is a difficult question.
Let’s take two extremes:
- if you include a simple onclick=’alert(“hello!”)’ it works, no problem
- if you include the “script” tag and lines of code, the script will be included in the page but not executed.
There are lots of variations around this, and I’ll publish more examples next year. For more information on this topic, search the Web for “script” and “innerHTML”. Note that the behavior also depends on the browser you use.
December 29, 2008 at 5:07 pm
TM
Hi Christophe! I am trying to use your wonderful guidance, but after I add the script to the CEWP, I get a pop up that says “Cannot retrieve properties at this time”. The title bar of that pop up shows Microsoft Internet Explorer. Then it won’t let me save the changes made to the CEWP. Any ideas? I’ve tried it several times. Thank you.
December 30, 2008 at 12:55 am
Christophe
TM: this is a technical issue with your server, you need to contact your support.
January 9, 2009 at 3:50 am
World Clock « Path to SharePoint
[...] last step is to apply our “HTML calculated column” method to convert the HTML strings into actual [...]
January 9, 2009 at 7:17 am
SharePoint OOTB Trend Reporting | End User SharePoint
[...] original script can be downloaded from Path to SharePoint. If you use SharePoint along with jQuery, note that Paul Grenier has published an adaptation for [...]
January 13, 2009 at 12:22 am
Mark
Hi Christophe,
Thanks for all of your wonderful examples so far! I’m wondering if you could help out with an adaptation. I’ve created a column type of Choice with multiple selections. Each selection would be a term such as “JQuery” or “CEWP” or “View”. I would like to portray these column values with the same text but in a format that would be accessible as a URL. So, if I clicked on the “CEWP” value in the list view web part, it would access the URL that I set in the calculated column. Does that make sense?
January 13, 2009 at 12:39 am
Christophe
Mark, see if this answers your question:
http://pathtosharepoint.wordpress.com/2008/09/01/how-to-open-hyperlinks-in-a-new-window-or-not/
There are other similar posts on my blog, for example here:
http://pathtosharepoint.wordpress.com/2008/09/15/events-in-html-calculated-columns/
January 13, 2009 at 7:19 pm
Mark
Thanks, that answers some questions. One final question I have would be around formatting. In your example, you are working with discrete values. How would you go about applying this with several possible values that would originate from a choice column type? Could you provide the formatting of that conditional column? It would be something like this:
If ColumnTitle=X then
CONCATENATE(““,Title,”“)
else if ColumnTitle=Y
CONCATENATE(““,Title,”“)
etc etc
January 13, 2009 at 8:19 pm
neftali
Hi Christophe and all,
After working with some of the cacluated column examples you have shown in various posts, I was wondering if it is possible to include a “multiple line text” column in a calculated column. I have tried the default “desrciption”column , as well as one i have created neither will allow me to enter it in to a caclulated column. i was just wondering if it was possible or not. thanks again
January 14, 2009 at 12:24 am
Christophe
Mark: the following post shows several examples of hyperlinks with conditional formatting, based on IF or CHOOSE:
http://pathtosharepoint.wordpress.com/2008/12/09/color-coding-more-examples/
January 15, 2009 at 10:15 am
Christophe
neftali: as you experienced, “multiple line text” is not accepted in formulas.
January 30, 2009 at 9:37 pm
Ryan
Hello Christophe,
Great work on this concept. I have one twist for you though. Using the method you described above I was able to create a calculated column to formulate the “Full Name” of a contact in a SharePoint list. This works great until I get to the point where I wanted to reference this column via a lookup field in a seprate list. In the area where you select the full name to populate the contact lookup column in my 2nd list, the HTML is rendered as plain text. I was wondering if you had any throughts on how to capture those select objects in javascript and formulate them so that they render the HTML properly. Any suggestions on this matter are greatly appreciated.
Thank You,
Ryan
January 31, 2009 at 1:57 am
Christophe
Ryan: you could apply a similar method. In the edit form, search for the DIV tags and convert them to HTML. However this is very intricate, I think this is pushing the method too far…
February 2, 2009 at 12:57 pm
Ryan
Hey there, thank you for the reply. I have actually come up with a solution to my original problem. Rather than trying to render the HTML elements within the column; I simply grab all of the “select” objects on the page, loop through their corresponding “option” objects, check the text property of the option object for the DIV tags, and if the tags are found then I run a regular expression against the text to remove all HTML tags from the text. This allows for the proper display in the select list, and leaves the value property of the option object with the DIV tags so the HTML is carried through to the new list.
Something interesting that I noticed while creating this script was that it appears that javascript is run after the page is loaded to actually populate the select object as the options are not visible in the source of the page. Rather, the values appear in hidden input objects that I can only assume are used to populate the select object with javascript. With that being the case, my code had to be wrapped into a function that I pushed into the body OnLoad event. Something that I still need to address is that when an item is removed from the list the text in the pick list is set back to the text with html tags. I plan on having that issue fixed later today. I will let you know what I find out.
My code if anyone is interested:
//This script is for re-rendering select options.
function ReRenderSelectObjects()
{
var oSelect = document.getElementsByTagName(’select’);
var x = 0;
var y = 0;
while(x < oSelect.length)
{
while(y < oSelect[x].options.length)
{
if ((oSelect[x].options[y].text.indexOf("<DIV") == 0) && (oSelect[x].options[y].text.indexOf("”) >= 0))
{
oSelect[x].options[y].text = oSelect[x].options[y].text.replace(new RegExp(/(]+)>)/ig),”"); ;
}
y=y+1;
}
y=0;
x=x+1;
}
}
_spBodyOnLoadFunctionNames.push(‘ReRenderSelectObjects’);
February 3, 2009 at 4:03 pm
Ryan
Hello everyone, I am finally finished with the code to correct the scenario that I stated above. I figured that since I asked a question, I should at least come back here and post my solution to the problem. My code is:
P.S.: Something that you may consider is placing this code, as well as the code provided by Christophe, at the bottom of the master page used by your SharePoint sites. The code is very lightweight so running on every page is not a big concern of mine, and having the code on the master page meens that you do not have to place this javascript on every page you want to render the html; thus encapsulating all of the logic for future updates. Just a suggestion.
Thank You,
Ryan
February 4, 2009 at 8:18 pm
Kirti
Hi Christophe,
It worked!!! What I had completely ignored was your instruction about placing the CEWP AFTER(below )the list . I changed that, and everything works great. Thanks so much. You’re such a genius!! and this blog is extremely helpful and very clear.
February 6, 2009 at 6:37 am
Dave
The JavaScript is working wonders for me on my Contacts list. My goal was to combine the First Name and Last Name fields, plus make them link to the display page for that contact (by adding the ID number to the end). It works well, however, I can’t get it to work on the home page of the site (Default.aspx), where I have added the contact list as a web part.
I have definitely added a CEWP to the home page and inserted the JavaScript code, yet the Full Name column just displays the raw HTML code.
Have I done something wrong? Or isn’t the JavaScript written to work anywhere besides the contacts list? I unfortunately don’t know JavaScript anywhere near well enough to modify the scripts. Any advice?
Cheers,
Dave
February 6, 2009 at 7:09 am
Christophe
Dave: it should work, check if you followed all the instructions (e.g. put the CEWP under the contacts list). Some help here:
http://pathtosharepoint.wordpress.com/2008/11/01/troubleshooting-your-html-calculated-column/
February 6, 2009 at 7:27 am
Dave
Ah, thank you very much. I had placed the CEWP before the contact list. It’s all good now. Thanks for the quick reply too.
Cheers,
Dave
February 9, 2009 at 7:57 pm
sharepointdiva
Wonderful post! This will help my non-technical users alot.
February 19, 2009 at 1:02 am
James
Chris,
First, thank you for the script. It has solved a major problem I was having, and is a great solution, and works great.
But, and isn’t there always a but…
I have found that when one adds the script to a page, different browsers behave differently. More precisely, different browsers are displaying the page at different speeds.
I ran some tests, and timed how long it takes when you click the link to the “coded” page, to when it’s fully loaded. The results are:
No Code, Internet Explorer 13 seconds, Firefox 5 sec, Chrome 3 sec
Your Code, Internet Explorer 57 seconds, Firefox 8 sec, Chrome 4 sec
Ryan’s Code*, Internet Explorer 63 seconds, Firefox 7 sec, Chrome 5 sec
Why is IE taking so long to load the page?
Normally I wouldn’t care, but the organisation I work for has IE as their standard browser, and for a page (on the intranet) to take around 1 minute to load would be seen as unacceptable.
Any ideas?
*note: Ryan’s code was the variation published to this thread on February 3, 2009 at 4:03 pm.
February 19, 2009 at 2:02 am
Christophe
Thanks for the feedback James.
First, it’s good to know that the code works in Chrome, I haven’t tried it yet.
I have also noticed that Firefox was faster, but I don’t see such a big difference…
My code could be optimized. The sample script I have published scans through the whole page, but we could restrict it to the Web Parts, or to one specific Web Part. How many Web Parts do you have on your test page? Feel free to send me more details by e-mail:
Christophe@PathToSharePoint.com
Also, Paul Grenier has proposed an adaptation of the script using jQuery, it would be interesting to see how it behaves in your environment:
http://www.endusersharepoint.com/?p=995
I’d love to hear feedback from other readers on performance tests!
February 19, 2009 at 2:09 am
Ryan
Hey there,
Unfortunately the performance of a javascript is very hard to predict and/or debug due to the fact that the code is executed on the clients machine.
In my implementation I observed no noticible delay in performance. If I had to guess, the most likely culprit would be the speed your client browser is able to retrieve the html objects from the page.
Sorry I couldn’t offer a better answer.
February 19, 2009 at 10:27 am
Tue
Hi
This works great for the “default view” in a List, but I can not get the code to work on any personal views created based on the default view. How do I add the code to the maser so it automatically applies to all screens?
Thanks!
February 25, 2009 at 10:24 pm
Tony
OK, I have something that I would like to do with a calculated column I use on a calendar view. What I’ve done is built a custom list that provides my department the ability to track infrastracture and technical change requests for dev, QA, and prod environments. We’ve implemented our own scheduling and tracking as the change request system has no real way to manage those change requests effectively, and most importantly , no way to see any meaningful schedule.
So, on the calendar view, I want to be able to have an additional link that takes the user straight into the change request system to view the change request, in addition to the standard one that displays the form view in SharePoint.
Any way to do this?
The formula for my calculated column is:
=”"&[ECM No]&” – “&IF([SCT Cross Impacted]=”Yes”,”(Non-SCT) “,”")&[ECM Brief Title]&IF([Major Tech Event]=”Yes”,” (Major Tech Event)”,”")&IF(Approved=”Yes”,” [Approved]“,” [Not Approved]“)&” Open ECM”
And it creates values for the column like this:
625538 – The Title of the Chage Request [Approved] Open ECM
When displaying the calendar view, it seems the IE picks up the URL and displays it on the status bar, but clicking the link always goes to the SharePoint form view. I suppose it is essentially an tag inside an tag, which I do not believe works. How to I get my own tag to be after the one SharePoint creates for the calendar item?
Thanks!
Tony
February 26, 2009 at 2:11 am
Christophe
Tony: I assume that you’re using my script for calendars, not the script from this post.
That’s correct, SharePoint links to the form view. Your custom links are buried under the SharePoint one and don’t work (btw this is mentioned in the post).
To achieve your result, you’ll need to modify the script so that it delete the default link before inserting your custom link.
February 26, 2009 at 10:37 am
Using calculated columns to write scripts « Path to SharePoint
[...] write HTML. If you are not familiar with this method, I strongly recommend that you first check out the post that started it all before reading the rest of this [...]
February 26, 2009 at 1:28 pm
Highlight rows in SharePoint lists « Path to SharePoint
[...] this post, I assume that you are familiar with the “HTML calculated column“. If not, be prepared to read several other references to catch [...]
February 26, 2009 at 2:37 pm
Tony
Hi Christophe. Thanks, I was pretty sure I’d have to modify some Javascript. I was not using your script, but one I wrote, which I did to give me colors based on status. I’ll switch to your script, get it working, then try to modify it so I can rework the “a” tag for the calendar items, and produce two “a” tags.
February 26, 2009 at 11:24 pm
Tony
OK, I’ve been able to modify the HTML for the two “A” tags, getting my calculated one in serial with the parent one SharePoint creates, not as a child node. But then I saw in the HTML that SharePoint generates that there is an OnClick attribute for the “TD” that is the parent node of both of the “A” tags. Would that override both child “A” tags hrefs?
Here’s the code I have thus far, admittedly not too clean, but I am trying to stay out of coding and development (and into PM, org building, and methodology/process stuff).
var theTDs = document.getElementsByTagName(“TD”);
var j = 0;
var TDContent = “”;
for (j = 0;j < theTDs.length; j++)
{
if (theTDs[j].className==”ms-cal-monthitem” || theTDs[j].className==”ms-cal-defaultbgcolor”)
{
theTDs[j].innerHTML= theTDs[j].innerHTML.replace(/</g,”);
//theTDs[j].OnClick = “void();” — I’ve tried removing the attribute, setting it to an empty string, etc. value never changes.
TDContent = theTDs[j].innerHTML;
if ((TDContent.indexOf(“=0 && (TDContent.indexOf(““) >= 0))
{
var A1PosSt = 0;
var A2PosSt = 0;
var A2PosEnd = 0;
A1PosSt = TDContent.indexOf(“<A “);
A2PosSt = TDContent.indexOf(“<A “,A1PosSt+1);
A2PosEnd = TDContent.indexOf(““,A2PosSt+1);
theTDs[j].innerHTML = TDContent.substring(A1PosSt,A2PosSt) + ““;
theTDs[j].innerHTML = theTDs[j].innerHTML + TDContent.substring(A2PosSt,A2PosEnd+4);
}
}
}
March 2, 2009 at 5:28 am
Live demo: jQuery sparklines « Path to SharePoint
[...] in bar type, the blog authority in the past 3 months. To build them I have combined the “HTML calculated column” with the jQuery sparklines [...]
March 4, 2009 at 3:05 am
JQuery for Everyone: AOP in Action - loadTip Gone Wild | End User SharePoint
[...] updated this script to render calcHTML columns (see HTML Calculated Column and jQuery [...]
March 4, 2009 at 4:12 pm
JQuery for Everyone: $.grep and calcHTML Revisited | End User SharePoint
[...] once in a while, good scripts need a second look. The calcHTML idea popularized by Christophe has such potential for frequent use, I decided to see if I can improve on [...]
March 6, 2009 at 6:57 am
Selinee
One little question, if I do it the way described above, all my special characters are replaced by the html code:
a href=” –> a href='
'><img
It works in the browser and is shown correctly, but the source code of the page looks really not fine. How can I change this?
March 9, 2009 at 1:08 pm
Tony
Selinee:
Are you looking at the source via View > Source? If so, it won’t look correct – it is the original source for the page. Use the IE Developer Toolbar. You may have to install it. This will show you the final HTML on the page.
March 17, 2009 at 9:45 pm
Paul
If you add the supplied script to the bottom of your master page or, better still, as an include with a function call to it at page bottom, might it then become available to any and all web parts on a given page?
Or is it reliant on the original list view containing the calculated column??
March 17, 2009 at 10:11 pm
Paul
Has anyone considered adding a custom class to the DIV tag in order to avoid any possible interference with page layouts when using web part pages? Is this a factor?
e.g. if ((TDContent.indexOf(“<DIV class=”2HTML”) == 0)
March 20, 2009 at 10:21 am
Christophe
Paul: I haven’t seen any case of interference so far. Keep in mind that the script is only looking at text fields and will ignore everything that is already html.
. The idea is the same, find a way to identify the text that needs to be converted.
Your solution should work however – just make sure it doesn’t interfere with an existing “2HTML” class
March 20, 2009 at 10:31 am
Christophe
As for your previous comment: you’re correct, by adding a call to the script in a Master page you’ll make it available in the whole site.
March 20, 2009 at 4:52 pm
Limimeame
Was ist das?
March 23, 2009 at 4:16 pm
Baris Wanschers
Wow, this is nice! Really works good, thanks!
March 30, 2009 at 8:12 pm
Sudheer
The above script works great !.. Good Job Christophe
April 4, 2009 at 1:12 am
Beyond Training’s Blog
[...] will greatly save lots of people time, but may also require being creative as you will see in Path To Sharepoint . Some of our lessons in our Advanced Sharepoint classes will touch on this and subjects like [...]
April 17, 2009 at 6:20 am
Demi
Hi Christophe,
Would like to find out.
Can we make use of the Calculate Field to select the workflow we want? Example, I have workflow A, B, C and approvers have been preset in the workflows. When user upload document, they will base on the need of the document and trigger the workflow. However, I do not want them to amend the approvers name in the workflow. I know if workflow is triggered manually, user is allowed to edit the information inside, which I do not wish to.
Hence, could we make use of the Calculate Field to carry out a check and trigger the correct workflow?
Any advise?
Thanks in advance.
April 17, 2009 at 1:40 pm
SharePoint Color Coded Calendar - The PayRoll Schedule | End User SharePoint
[...] we can put all of these element together in such a way that Christophe’s (Path to SharePoint) Text to HTML script can make the Content Editor Web Part do the color-coding we need. (Follow the [...]
April 20, 2009 at 3:12 am
JoyceMR
Christophe, is there any reason why this shouldn’t work with data rendered by a Business Data List View? It results in TDs on the page which contain DIVs with a link in them, but it does not convert to html on the page. Your CEWP is at the bottom of the last webpart zone on the page as recommended. I’m puzzled.
April 20, 2009 at 7:06 am
Christophe
JoyceMR: my sample code assumes that DIVs are in upper case and in the beginning of the string. Is it the case for you? If not, you may need to teak the code (lines 15 and 40).
April 22, 2009 at 5:40 am
JoyceMR
Yes, my DIVs are uppercase and are visible as text in the BDC List View web part fields on the rendered web page, but after further research I find that that they are not visible when I do right-click View Source on the page. SharePoint must be doing something complex with the BDC controls that doesn’t let us get to the source to change the display. Rats!
April 22, 2009 at 2:10 pm
Thomas
Thanks a lot Christophe: that’s really a key achievement to enhance end-user ability to quickly customize their pages.
April 23, 2009 at 8:44 pm
undergroundchurch
I cannot use the content editor for this, so I was wondering if it is possible to incorporate it in the default.aspx of the site so that when I display the list on the main page, it will show the calculated field.
So far, I added the code above to the default.aspx, and the code shows up in the web page, but does not convert the DIVs
April 24, 2009 at 1:58 am
Christophe
You can add the code to default.aspx or to the master page, just make sure that you place it at the bottom of the page so that it runs AFTER your list is loaded.
April 24, 2009 at 3:53 pm
undergroundchurch
I did that and can get the code to show up in when i view source, but it does not change anything. After that, I found another web part called “Form web part” and put it in there. I again got the code to show up, but it is not translating the DIV.
I noticed that the entire content for the list item shows up on one line. Don’t know if that matters. The return for the field….
Wait….
Just got it. I moved my web part to the last in the list, and it worked. Boom Baby!!!
May 6, 2009 at 7:19 am
Venkat
hi Christophe,
I am very thankfull to ur work.
i am having one task like this.
I am having list columns with tuype choice by values red,green and yellow.
when the user one click on new button in list and he will enter his data and choice one color from choice column and click ok. now when we see in list choice column if he select Green background color of column must be Green.
Can u help me in this way.
May 6, 2009 at 8:50 pm
Ezra’s Software Development Notepad » Reporting on Sharepoint data using the Sharepoint content database
[...] added to the bottom of the page a Content Editor Web Part and dropped in Chrisophe’s script from here, so the page links properly to the [...]
May 7, 2009 at 6:33 am
Christophe
Venkat: browse my blog, you’ll find several examples. Also, check out the formula generator:
http://pathtosharepoint.wordpress.com/2009/04/21/color-coding-formula-generator/
May 18, 2009 at 11:24 am
Nigel
Hi Christophe. Thanks for this, it ‘almost’ provides the perfect solution for me!
I am using it on a Calendar view, and it works perfectly *unless* the item only spans one day, i.e. The End date for the item is the day after the Begin date (the item would be contained in just one cell of the calendar) – in this case, the html just appears as plain text. The rest of my calendar items, which span more than one day, appear in lovely multicolor!.
Any ideas ??
May 18, 2009 at 12:42 pm
Nigel
Hi again. One little extra point – with the color coding in place, the calendar item text is no longer a hyperlink to the calendar item. Is it possible to retain the link behaviour ?
May 18, 2009 at 1:29 pm
Christophe
Nigel: which script are you using?
As explained in the beginning of the post, this script is for lists, there’s another version for calendars.
May 19, 2009 at 2:19 pm
eric
I seem to be having problems with this in Firefox/Chrome. I can see the script working, but it does not render the bar on the page, it just shows up as blank space.
I’m using the list script on a web part with the javascript embedded on the very bottom of my masterpage.
May 19, 2009 at 6:45 pm
Christophe
Sorry eric, what bar are you talking about?
May 19, 2009 at 7:46 pm
eric
Sorry, I didn’t expalint it well and or commented on a wrong post. It’s just a html calculated value that displays a full percentage.
=” ”
Using the above script you provided, this is rendered as a progress bar and works fine in IE. In Firefox and Chrome, the text is removed from the view, but is not replaced with the progress bar.
Other posts indicated that it did work in other browsers.
May 19, 2009 at 7:48 pm
eric
Removed some of the code so it would post.
DIV style=’background-color:LimeGreen;’>DIV style=’background-color:red; width:”&([Filled Seats]/[Total Seats]*100)&”%;’> </DIV
May 20, 2009 at 6:50 pm
eric
Disregard my question, i forgot to add between the divs for it to render appropriately in Firefox and Chrome.
May 20, 2009 at 12:49 pm
Scott
This is awesome since we don’t have access to our server or central admin. We are using the traffic light (large bullet) option. Question boss has is: Is there a way to show something else in the filter dropdown in the column heading. Now it shows html code. is there a way to show even words like Red, Yellow, Green so we can filter to see only the projects that are red?
thanks for all your hard work
May 20, 2009 at 12:51 pm
Scott
Also, would be cool if when user moused over the traffic light it actually showed the calculated percentage. Is that possible?
May 23, 2009 at 10:39 am
Christophe
Scott: I am aware of this filter issue, unfortunately I don’t have a clean solution to share yet.
You can add the mouseover behavior by changing the formula: simply add a title attribute to the DIV tag.
July 28, 2009 at 5:35 pm
Ruth
I’ve made this script work in a DVWP and in there you can us the “regular” column as the header and substitute the “formatted” column in the table cells – that way the data filters properly and displays propertly. I’ve used the cacluated fields on other custom views and forms – works great! Much more scalable than lots of conditional formatting. Thanks for the post!
May 25, 2009 at 3:58 pm
anon
Note: the web content part must be on the bottom of the page for some reason.. probably to execute after the rest of the page is rendered. If its at the top you will just see the div code..
June 4, 2009 at 11:37 am
HTML Calculated Column – Updated script « Path to SharePoint
[...] (SharePoint 2003 and 2007) and calendars. Its purpose is to replace the scripts currently published here and [...]
June 4, 2009 at 7:44 pm
Todd
Hi, I used the above script on some document libraries and it worked great! I am having issues getting it to work with lists though. I see that the code is indeed added to the page through the CWP but the HTML is still showing. Is it possible there is an issue with the script? Have you updated it recently?
Thanks great post!
June 4, 2009 at 8:10 pm
Todd
I seemed to have narrowed the issue down to grouping. When the list/document lib. is grouped by a value and not expanded the code works. When not grouped it fails. Looking at the code to see if I can figure out the issue.
June 4, 2009 at 8:19 pm
Todd
Narrowed the issue down a bit more. Only works on colapsed grouped by…
June 5, 2009 at 1:45 am
Christophe
Todd: I regularly update the “HTML calculated column” method, and you can read a summary at the top of the post. The script is widely used, in particular by my own customers.
Yesterday I just published v 2, so you may want to try it out (no documentation yet):
http://pathtosharepoint.wordpress.com/2009/06/04/html-calculated-column-updated-script/
Also remember to check out the troubleshooting section (see link in the post).
If it still doesn’t work, feel free to contact me with more details (list type, view style, etc.) at Christophe@PathToSharePoint.com
June 5, 2009 at 3:08 pm
Todd
I believe my issue was that I had the CEWP WP at the top of the page. Thanks for your quick responce and all of your helpfull effort!
June 16, 2009 at 4:12 am
Color coding: more examples « Path to SharePoint
[...] I already published an article about color coding for SharePoint lists three months ago, and its sibling for calendar views last month. Both rely on the same client side method, the “HTML calculated column“. [...]
June 18, 2009 at 12:32 am
Add Status Style Icons to SharePoint List « Rock Webcast
[...] http://pathtosharepoint.wordpress.com/2008/09/01/using-calculated-columns-to-write-html/ [...]
June 19, 2009 at 6:27 am
Turbo charge your sharepoint lists by using calculated columns to write HTML - PeteStilgoe.com
[...] Using HTML in calculated columns [...]
June 25, 2009 at 11:54 pm
dork
I love “Friends” (it’s 5 on a thurs – my brain needed a break)
June 26, 2009 at 3:40 am
Case study: KPI roll-up in MOSS (Part I) « Path to SharePoint
[...] touch is to add the script for the HTML calculated column (the instructions were initially posted here, but make sure you grab the updated version of the script). Your tasks list should now look like [...]
July 9, 2009 at 11:45 am
HTML Calculated Column – Updated script « Path to SharePoint
[...] you haven’t heard about the HTML Calculated Column yet, check out these links: – the method, explained (includes version 1.0 of the script) – an example: apply color coding to lists – a [...]
July 14, 2009 at 7:53 pm
EK
Thank you so much for sharing this, Christophe! I had already constructed the HTML I wanted in my calculated column, but was at a loss when it came to getting SP to display it properly. Your updated code flawlessly tackled the problem, however, and it’s now my list is doing exactly what I wanted. Fabulous!
Thanks again!
July 26, 2009 at 11:46 pm
HTML calculated column and Data View Web Part « Path to SharePoint
[...] The HTML calculated column This is a technical post that assumes you are familiar with the HTML calculated column and the Data View Web [...]
July 28, 2009 at 4:36 pm
Roy
Just used your solution and worked like a gem. Thanks so much for sharing this.
August 7, 2009 at 8:15 pm
Mike D.
Christopher,
What can I do if I do not have access to CEWP???
Any other way to make it behave as real HTML???
August 17, 2009 at 4:31 pm
Chris
Hi,
I must be doing somethign wrong but not sure what.
What I want to do is this.
I have a calendar list, and I’ve added column named ‘Number Type’ when the user makes an entry, they must select from 3 choices.
So what I want to happen is on the page I’ve added the calendar view, depending on what choice is select, the title will be a different color.
I’ve added the following calculated column to my calendar list.
=” “&Title&”"
I’ve then also added the DWP after my calendar webpart on my page.
But the ‘Title is not changing colors at all.
I’ve went back to the calendar list, and when I view it in list view. The ‘display’ field, lists out the HTML and for each entry it seems to be listing the correct color.
So it seems the DWP is not working, or I’m doing something wrong.
Any ideas?
August 17, 2009 at 4:32 pm
Chris
hmm, looks like my code didn’t all appear, but I used the generator to get my code, and like I said the HTML code looks to be selecting the right color. It’s just not doing anything on my page.
August 27, 2009 at 4:31 pm
Gabriel
Works like a charm.
Thank you!
August 31, 2009 at 7:48 pm
SharePoint Steve » Running SharePoint Code with Elevated Privileges – A Real Example
[...] The tricky part here is having to call item.update() twice. You have to call it twice because the first time you call it is when the list item is actually created. Before then, it does not have a Unique ID to reference. So once it is created, you can grab the Unique ID, and populate the Link field with a HTML formatted URL that references the item and can be easily inserted into a HTML based email or a page that has a content editor web part CEWP with the javascript in it found here. [...]
September 3, 2009 at 3:54 pm
The HTML Calculated Column, one year later « Path to SharePoint
[...] then, but to date the “HTML Calculated Column” remains by far the most popular. The original post has been viewed more than 45,000 times, while its little sister explaining how to use the technique [...]
September 21, 2009 at 6:54 am
Jeremy
Chris,
Thank you for this.
I am on a hosted 2007 WSS environment and am wondering if you know of any server settings that would prevent your solution from working. I have implemented other text/javascript CEWP without trouble but not on the Calc Column. I have aslo experienced difficulty implementing Lytebox (in case it helps to understand teh issue).
As far as I know, I have followed your instructions (Exact replication of your example above with no code changes and have added the CEWP under the target WP with your ecat script).
It does not display a read-out of the Calc Column formula but simply the concatenated first and last name with no bold formatting.
I appreciate any advice you can give. Thank you.
-JL
October 11, 2009 at 1:14 pm
Christophe
Jeremy, if you cannot see the div tags on your page it means that the solution is working. There may be a typo in your formula that prevents the styles from applying.
September 30, 2009 at 2:59 pm
Michael
Hi, thanks for this, it’s working great, but I run into 1 issue when adding or modifying a item. I have a calculated column with a link to DispForm.aspx to display 1 item, so the calculation is based on the ID (ID=”,ID,”). Works like describe. But now when I add a new item or edit a exsisting one, the ID is not in the url. Only when I go to List settings, open the calculated column and save it (without making changes) the ID’s are added to the links. How can I et this to work that the ID is displayed without doing this kind of action? Your help is much appreciated.
Best regards,
Michael
October 5, 2009 at 10:37 am
Christophe
Michael: as mentioned in this post, you should not use the ID field in calculated columns.
A workaround is to run a workflow that copies the ID to another column…
October 1, 2009 at 2:02 pm
LOVE_MOSS_NOT
Thank you, what a hack! I can’t blame ya after SharePoint being such a leaky abstraction…