问题描述
我正在编写Microsoft Dynamics 365版本1612(8.2.2.113)的报告,该报告使用以下表达式:
I'm writing a report for Microsoft Dynamics 365 Version 1612 (8.2.2.113) which uses the following expression:
=IIF(LookupSet("Test", Fields!new_product_name.Value, Fields!new_product_code.Value, "Test_DataSet").Length = 0,
"",
LookupSet("Test", Fields!new_product_name.Value, Fields!new_product_code.Value, "Test_DataSet")(0)
)
想法是返回名称为 Test的第一个产品的代码,如果不匹配则返回空白。
The idea is to return the code of first product with name as "Test", and return blank if there is no match.
但是,因为SSRS中的IIF不会短-电路,即使没有匹配项,它仍然会尝试从LookupSet获取第一个(索引= 0)元素,然后引发错误。
However, because IIF in SSRS does not short-circuited, even if there is no match, it will still try to get the first (index = 0) element from LookupSet and then throw an error.
我该如何存档我要做什么?
How can I archive what I'm trying to do?
推荐答案
如果只需要第一个结果,那么您应该可以使用查找
。您尝试过吗?
If all you need is the first result, then you should be able to just use Lookup
. Have you tried that?
查找
返回第一个结果(如果有结果),或者返回没有结果
,如果没有结果。
Lookup
returns the first result if there are any results, or Nothing
if there are no results.
这篇关于如果Dynamic 365的SSRS中不为null,则获取LookupSet结果的第一个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!