SSRS 请求并显示SharePoint人员和组字段
2013-06-19 16:17
85 查看
场景:
使用Reporting Service请求SharePoint List,该list中包含人员和组字段。要求:只显示人员或组的display name。示例如下:
步骤:
1. 替换";#"成"@@"
2. 按";"分割成数组,遍历数组,循环取出值
3. 按"#"分割字符串,取数组第一个值
4. 按"@@"分割字符串,取数组第二个值
报表字段里插入fx,值等于
预览。
P.S.
在RS中的IIF用起来跟传统的if判断有点不同。IIF不是个表达式,而是个方法,这个方法有3个参数。
也就是说,Condition,ValueIfTrue,ValueIfFalse在运行的时候都会执行。如果你想这样玩儿,你就会失望了。
不管条件InStr(Fields!User.Value,";") > 0成功与否,Split(Fields!User.Value,";").GetValue(1)都会执行。是不是相当不爽???!!!
使用Reporting Service请求SharePoint List,该list中包含人员和组字段。要求:只显示人员或组的display name。示例如下:
项目 | 参与人员 | 期望显示 |
项目1 | 张三#contoso\zhangsan;李四#contoso\lisi;19;#王五;管理员组 | 张三;李四;王五;管理员组 |
1. 替换";#"成"@@"
2. 按";"分割成数组,遍历数组,循环取出值
3. 按"#"分割字符串,取数组第一个值
4. 按"@@"分割字符串,取数组第二个值
Public Function GetPersionName(Combined As String) As String if (InStr(Combined ,"@@") > 0) Then Return Split(Combined,"@@").GetValue(1) Else if(InStr(Combined ,"#") > 0) Then Return Split(Combined,"#").GetValue(0) Else Return Combined End If End If End Function Public Function GetPersionNameStr(Combined As String) As String if (Combined ="") Then return "" End If dim returnStr,i returnStr= "" Combined = Replace(Combined,";#","@@") if (InStr(Combined ,";") > 0) Then for i = 0 to Split(Combined,";").Length - 1 dim str = Split(Combined,";").GetValue(i) returnStr = returnStr+ GetPersionName(str) + ";" next Return returnStr Else Return GetPersionName(Combined)+";" End If End Function
报表字段里插入fx,值等于
=Code.GetPersionNameStr(Field!参与人员.Value)
预览。
P.S.
在RS中的IIF用起来跟传统的if判断有点不同。IIF不是个表达式,而是个方法,这个方法有3个参数。
IIF(Condition, ValueIfTrue, ValueIfFalse)
也就是说,Condition,ValueIfTrue,ValueIfFalse在运行的时候都会执行。如果你想这样玩儿,你就会失望了。
IIF( InStr(Fields!User.Value,";") > 0 ,Split(Fields!User.Value,";").GetValue(1) ,Fields!User.Value )
不管条件InStr(Fields!User.Value,";") > 0成功与否,Split(Fields!User.Value,";").GetValue(1)都会执行。是不是相当不爽???!!!
相关文章推荐
- Sharepoint中用treeview来显示组织机构的人员状态的webpart
- 如何显示与隐藏Sharepoint列表中的指定字段
- SharePoint 列表视图修改多行文本字段显示长度
- SharePoint 2013 在Discussion board 视图中显示非标准字段的值
- Sharepoint中用treeview来显示组织机构的人员状态的webpart
- 在SharePoint 2010中修改XsltListViewWebPart显示字段样式
- SharePoint对象模型设置字段是否在新建编辑显示页面中显示
- 如何隐藏与显示Sharepoint列表中的字段
- jquery-ajax请求action读取oracle数据库clob字段xml数据格式化显示(struts2)
- SharePoint 判断用户是否在字段"人员和组"里面
- SharePoint 2013 中使用JSLink 来改变列表中某个字段或view(视图)的显示方式
- 让SharePoint计算字段显示Html
- 让SharePoint计算字段显示Html(转:涂署光博客)
- SharePoint 判断用户是否在字段"人员和组"里面
- Sharepoint中用treeview来显示组织机构的人员状态的webpart
- SSRS Report新加字段如何在Visual Studio 显示出来
- SharePoint, 如何在列表项的只读界面DispForm.aspx控制字段的显示和隐藏
- SharePoint 字段开发 显示视图显示一个超链接
- 在sharepoint中使用NameCtrl显示人员状态
- Oracle 中多个字段显示成一列