How To: 用 SharePoint 计算列做出你自己的KPI列表(转)
2013-01-16 14:42
381 查看
转自 努力的小熊 /article/4716610.html
如何在计算列中使用"Today",参见小熊的/article/4716609.html简略描述下,先建个Today列,再建计算列(计算列中的列名使用Today,不要使用[]框起),然后删除该Today列。
关于这个计算列的应用我是利用公司的网络在国外的blog看到的,国内需要FQ才能看到,真不知道这有什么可封的,唉……分享给大家吧:)
要做成这个KPI效果需要一个辅助的Column。我先简单叙述一下场景。一个SharePoint Task列表,我们要根据Today和Due Date两个时间之间的关系来显示不同的KPI。
规则是这样的:
1 Today < Due Date = Green Status Icon
2 Today >= Due Date = Red Status Icon
3 Due Date not filled out = N/A
1 Create Today Column. Column type is "Date and Time".
2 Create the first Calculated Column and named "DateDiff".
3 Input formula: =IF([Due Date]="";"2";IF(Today<[Due Date];"1";"0")).
"0" : Today >= Due Date
"1" : Today < Due Date
"2" : Due Date = ""
4 Select "Single line of text" of "The data type returned from this formula is".
![](http://images.cnblogs.com/cnblogs_com/bear-study-hard/2012/20120612f.png)
5 Upload icons to the picture library which we want to use.
![](http://images.cnblogs.com/cnblogs_com/bear-study-hard/2012/20120612g.png)
此处稍微修改:
1. 直接将三个文件放入Layouts目录即可,这样多个站点都可以通用这3个图片。
2. src=http://nnitsharepoint/SiteImage/ewr209m.gif修改为 src=../_layouts/IMAGES/ewr219m.gif
最终计算列值:
=IF(Status="Cancel","<DIV><img src=_layouts/IMAGES/ewr210m.gif></DIV>",IF(Status="Issue","<DIV><img src=_layouts/IMAGES/ewr219m.gif></DIV>",IF(Status="Completed","<DIV><img src=_layouts/IMAGES/ewr217m.gif></DIV>","")))
6 Back to the list. Create "Status Icon" column. Column Type is "Calculated". "The data type returned from this formula" is "Single line of text". Input the formula:
=IF([DateDiff]="1","<DIV><img src=http://nnitsharepoint/SiteImage/ewr209m.gif></DIV>",IF([DateDiff]="0","<DIV><img src=http://nnitsharepoint/SiteImage/ewr210m.gif></DIV>",IF([DateDiff]="2","N/A")))
7 We will get this result of this list.
![](http://images.cnblogs.com/cnblogs_com/bear-study-hard/2012/20120612h.png)
8 Now we have to change HTML to a picture.
Add a Content Editor Web Part to the page and add it below the Tasks Web Part. And input its content.
9 We will see the result like this.
![](http://images.cnblogs.com/cnblogs_com/bear-study-hard/2012/20120612i.png)
10 Delete the Today column. We get the correct result.
![](http://images.cnblogs.com/cnblogs_com/bear-study-hard/2012/20120612j.png)
原文地址: http://sharepointpratik.blogspot.dk/2011/06/add-image-to-custom-list-with_30.html(需要FQ)
另外一种实现方式:/article/6473586.html
如何在计算列中使用"Today",参见小熊的/article/4716609.html简略描述下,先建个Today列,再建计算列(计算列中的列名使用Today,不要使用[]框起),然后删除该Today列。
关于这个计算列的应用我是利用公司的网络在国外的blog看到的,国内需要FQ才能看到,真不知道这有什么可封的,唉……分享给大家吧:)
要做成这个KPI效果需要一个辅助的Column。我先简单叙述一下场景。一个SharePoint Task列表,我们要根据Today和Due Date两个时间之间的关系来显示不同的KPI。
规则是这样的:
1 Today < Due Date = Green Status Icon
2 Today >= Due Date = Red Status Icon
3 Due Date not filled out = N/A
1 Create Today Column. Column type is "Date and Time".
2 Create the first Calculated Column and named "DateDiff".
3 Input formula: =IF([Due Date]="";"2";IF(Today<[Due Date];"1";"0")).
"0" : Today >= Due Date
"1" : Today < Due Date
"2" : Due Date = ""
4 Select "Single line of text" of "The data type returned from this formula is".
![](http://images.cnblogs.com/cnblogs_com/bear-study-hard/2012/20120612f.png)
5 Upload icons to the picture library which we want to use.
![](http://images.cnblogs.com/cnblogs_com/bear-study-hard/2012/20120612g.png)
此处稍微修改:
1. 直接将三个文件放入Layouts目录即可,这样多个站点都可以通用这3个图片。
2. src=http://nnitsharepoint/SiteImage/ewr209m.gif修改为 src=../_layouts/IMAGES/ewr219m.gif
最终计算列值:
=IF(Status="Cancel","<DIV><img src=_layouts/IMAGES/ewr210m.gif></DIV>",IF(Status="Issue","<DIV><img src=_layouts/IMAGES/ewr219m.gif></DIV>",IF(Status="Completed","<DIV><img src=_layouts/IMAGES/ewr217m.gif></DIV>","")))
6 Back to the list. Create "Status Icon" column. Column Type is "Calculated". "The data type returned from this formula" is "Single line of text". Input the formula:
=IF([DateDiff]="1","<DIV><img src=http://nnitsharepoint/SiteImage/ewr209m.gif></DIV>",IF([DateDiff]="0","<DIV><img src=http://nnitsharepoint/SiteImage/ewr210m.gif></DIV>",IF([DateDiff]="2","N/A")))
7 We will get this result of this list.
![](http://images.cnblogs.com/cnblogs_com/bear-study-hard/2012/20120612h.png)
8 Now we have to change HTML to a picture.
Add a Content Editor Web Part to the page and add it below the Tasks Web Part. And input its content.
<script type="text/javascript"> // // Text to HTML // 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>
9 We will see the result like this.
![](http://images.cnblogs.com/cnblogs_com/bear-study-hard/2012/20120612i.png)
10 Delete the Today column. We get the correct result.
![](http://images.cnblogs.com/cnblogs_com/bear-study-hard/2012/20120612j.png)
原文地址: http://sharepointpratik.blogspot.dk/2011/06/add-image-to-custom-list-with_30.html(需要FQ)
另外一种实现方式:/article/6473586.html
相关文章推荐
- How To: 用 SharePoint 计算列做出你自己的KPI列表
- SharePoint 2010 列表字段之KPI
- SharePoint列表计算栏的公式中,可是使用哪些函数?
- SharePoint列表计算栏的公式中,可是使用哪些函数?
- 通过jQuery控制SharePoint展现——计算栏KPI和标签云
- sharepoint 2010自定义访问日志列表设置移动终端否和客户端访问系统等计算列的公式
- SharePoint 计算列返回图片
- SharePoint 2007中 利用ListViewWebpart 和DataViewWebpart 跨站点 调用列表或者文档库
- SharePoint-WebPart中动态选择站点和列表
- 通过sharepoint 客户脚本,验证列表添加页面上的时间
- SharePoint 2013 中代码创建列表查阅项字段
- SharePoint 2010 列表日期区间筛选(2)
- SharePoint中30个列表对应的数字值
- SharePoint 中列表的用户组权限
- C# 对sharepoint 列表的一些基本操作,包括添加/删除/查询/上传文件给sharepoint list添加数据
- 如何删除sharepoint列表List中的全部数据。
- SharePoint 2010 快速隐藏列表项目的下拉菜单
- SharePoint服务器端对象模型 之 访问网站和列表数据(Part 1)
- SharePoint 2010中列表Add和Delete事件解析
- SharePoint 导入列表