reporting-services - Converting * character in SSRS Expression
问题描述
I am using the following expression in SSRS
=IIF(ReportItems!Textbox69.Value = "~*",
"Excellent", IIF (ReportItems!Textbox69.Value = 1,
"Very Good", IIF (ReportItems!Textbox69.Value = 2,
"Good", IIF (ReportItems!Textbox69.Value = 3,
"Modest", "Cause for Concern")
)
)
)
When I run my report, all the fields that had a * originally are coming up as an error. How can I convert this character please?
解决方案
由于您的文本框包含字符串,因此您必须在比较中使用引号
=IIF(ReportItems!Textbox69.Value = "*",
"Excellent", IIF (ReportItems!Textbox69.Value = "1",
"Very Good", IIF (ReportItems!Textbox69.Value = "2",
"Good", IIF (ReportItems!Textbox69.Value = "3",
"Modest", "Cause for Concern")
)
)
)
我还建议考虑使用 Switch 而不是嵌套的 Iif
= Switch(
ReportItems!Textbox69.Value = "*", "Excellent",
ReportItems!Textbox69.Value = "1", "Very Good",
ReportItems!Textbox69.Value = "2", "Good",
ReportItems!Textbox69.Value = "3", "Modest",
True,"Cause for Concern"
)
推荐阅读
- javascript - Changing state with body width change in React
- io - MetaGraphs 加载和保存
- c# - How to design code for a given task following software design pattern?
- php - 在特定的 div 容器中显示 php 结果
- java - Jackson/Jax-rs 可以有可选数据吗?
- php - Lumen - 在服务提供者中注册类
- windows - Import-CSV 的 Powershell 奇怪行为
- sql - 我如何选择 FROM..WHERE 然后在 SQL 中加入?
- actions-on-google - Google 操作中的会话属性
- python - 使用变量python 3将标准输出重定向到文件