具有 Like 或 Contains 关键字的多个数据集

Multiple Datasets with Like or Contains Keyword

我正在尝试使用数据集值以及 Like 或 Contains 语句来过滤表达式。我有 7 个数据集(Outline_info、Product_info、Materials_Info、Wiring_info 等),每个数据集都有一些计算字段。例如,"Product_info" 数据集包含 productID、qty、unitofmeasure 等字段,这些字段通过存储过程得到填充

我在报告的文本框中添加了以下值:

=IIF((Fields!productID.Value,"Product_Info") = "J*", ("Jacket: " & First(Fields!productID.Value,"Product_Info")), ("Tops: " & First(Fields!productID.Value,"Product_Info")))

在上面的表达式中,我正在检查,如果 productID 字段以 "J" 开头,即 ((Fields!productID.Value,"Product_Info") = "J*"),那么我希望文本框以 "Jacket: ProductID Value" 开头,即 ("Jacket: " & First(Fields!productID.Value,"Product_Info")),否则 "Tops: ProductID Value" 即 ("Tops: " & First(Fields!productID.Value,"Product_Info")).

但我在尝试处理报告时遇到以下错误: 文本框 "ProductID" 的值表达式引用字段 "ProductID" 而未指定数据集聚合。当报表包含多个数据集时,数据区域外的字段引用必须包含在指定数据集范围的聚合函数中。

您不能将通配符与“=”一起使用,因此您必须像这样使用 LEFT 函数。

=IIF(
    LEFT((Fields!productID.Value,"Product_Info"),1) = "J"
        , "Jacket: " & First(Fields!productID.Value,"Product_Info")
        , "Tops: " & First(Fields!productID.Value,"Product_Info")
)

还要确保字段名称拼写正确,区分大小写。