用报告生成器中的特定文本替换不同的值 [英] Replace different values with specific text in report builder
问题描述
我有一个将返回数字的表格,我需要将其转换为文本标签
I have a table that will return a number and i need to convert it into a text label
20 = 已输入,30 = 已退回,200 = 已取消,220 = 已完成,300 = 已删除
20 = Entered, 30 = Returned, 200 = Cancelled, 220 = Complete, 300 = Deleted
我希望这些在我的报告中显示为简单的完成"等
I want these to show in my report as simply 'Complete' etc.
我无法使用替换功能来获取一个值以在报告中正确显示:
Im able to use the replace function to get one value to show correctly in the report:
=Replace(Fields!status.Value,"220","Complete")
但我不知道如何针对将在此列中显示的每个可能的数字执行此操作
But i cant work out how to do this for each possible number that will show in this column
推荐答案
最好的方法可能是使用前面提到的 CASE 语句修改查询,如果您能够这样做的话.但如果没有,嵌套替换的更简洁的替代方法是简单地使用 Switch 语句:
Best way would likely be modifying the query with a CASE statement as mentioned, if you are able to do that. But if not, a cleaner alternative to the nested Replaces would be to simply use a Switch statement:
=Switch(
Fields!Status.Value = "20", "Entered",
Fields!Status.Value = "30", "Returned",
Fields!Status.Value = "200", "Cancelled",
Fields!Status.Value = "220", "Complete",
Fields!Status.Value = "300", "Deleted"
)
这篇关于用报告生成器中的特定文本替换不同的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!