惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Privacy & Cybersecurity Law Blog
V
V2EX
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
The Register - Security
The Register - Security
MongoDB | Blog
MongoDB | Blog
P
Privacy International News Feed
The Last Watchdog
The Last Watchdog
Security Archives - TechRepublic
Security Archives - TechRepublic
美团技术团队
Stack Overflow Blog
Stack Overflow Blog
博客园 - 司徒正美
博客园 - 三生石上(FineUI控件)
V
Visual Studio Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
K
Kaspersky official blog
S
Secure Thoughts
T
Tenable Blog
Security Latest
Security Latest
The Cloudflare Blog
S
Security @ Cisco Blogs
H
Heimdal Security Blog
aimingoo的专栏
aimingoo的专栏
TaoSecurity Blog
TaoSecurity Blog
Blog — PlanetScale
Blog — PlanetScale
Microsoft Security Blog
Microsoft Security Blog
Schneier on Security
Schneier on Security
Webroot Blog
Webroot Blog
G
Google Developers Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Scott Helme
Scott Helme
IT之家
IT之家
Latest news
Latest news
The Hacker News
The Hacker News
C
Check Point Blog
T
The Exploit Database - CXSecurity.com
H
Hackread – Cybersecurity News, Data Breaches, AI and More
腾讯CDC
C
CERT Recently Published Vulnerability Notes
NISL@THU
NISL@THU
N
News | PayPal Newsroom
Forbes - Security
Forbes - Security
P
Palo Alto Networks Blog
S
Security Affairs
S
Securelist
Google Online Security Blog
Google Online Security Blog
WordPress大学
WordPress大学
Last Week in AI
Last Week in AI
C
Cybersecurity and Infrastructure Security Agency CISA
A
About on SuperTechFans

博客园 - stefanie

SQL - 获取多机构最近相同节点 PowerShell-将CSV导入SQL Server [Powershell] 检查IIS设置 VBS 操作注册表 十六进制 无法在People Picker中选择用户 Microsoft Certification List WINDOWS 2012忘记密码之后。。。 Auto Install Workflow Manager 1.0 批量删除Kindle Personal Documents 导入Excel表格到SharePoint站点 用户中心 - 博客园 [Powershell] FTP Download File [PowerShell] Backup Folder and Files Across Network VS 2010 安装 .net framework2.0/3.0/3.5 How to Setup AssociatedOwnerGroup / AssociatedMemberGroup / AssociatedVisitorGroup RPC服务不可用 [转]SharePoint Versions 安装 64 位版本的 Office 2010 后,无法查看数据表视图中的列表 [MOSS]关闭弹出窗口
SSRS 请求并显示SharePoint人员和组字段
stefanie · 2013-06-19 · via 博客园 - stefanie

场景:

使用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)都会执行。是不是相当不爽???!!!