Get the first value of result of LookupSet if not null in SSRS for Dynamic 365

时光毁灭记忆、已成空白 提交于 2019-12-25 09:40:07

问题


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)
 )

The idea is to return the code of first product with name as "Test", and return blank if there is no match.

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?


回答1:


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.



来源:https://stackoverflow.com/questions/46949286/get-the-first-value-of-result-of-lookupset-if-not-null-in-ssrs-for-dynamic-365

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!