SSRS中的Lookupset函数返回奇怪的错误

Mic*_*son 2 reporting-services

我正在尝试在ssrs中使用lookupset函数,并且不断收到此错误:

[rsLookupOfInvalidExpressionDataType] The Value expression for the textrun ‘Textbox46.Paragraphs[0].TextRuns[0]’ uses a lookup function with an expression that returned a data type that is not valid for the lookup function. The data type must be an RDL Variant type.
Run Code Online (Sandbox Code Playgroud)

我的第一个数据集如下所示:

Student Name      | PID
Anakin SkyWalker  | 1
Obi-Wan Kenobi    | 2
Run Code Online (Sandbox Code Playgroud)

我的第二个数据集(名为Awards)如下所示:

PID  | Xtrnl_Award_Type
2    | BA
Run Code Online (Sandbox Code Playgroud)

我正在使用的表达式是:

=Join(LookupSet(Fields!PID.Value, Fields!PID.Value, Fields!Xtrnl_Award_Type_Code, "Awards"), ",")    
Run Code Online (Sandbox Code Playgroud)

如果此人在第二个数据集中没有条目,则表示一切正常。但是,如果这样做,我的专栏只会显示#Error而不是逗号分隔的奖项列表。如果有帮助,该字段是varchar。我不明白为什么会出现错误,或者如何才能看到表达式返回的内容。有人可以帮忙吗?

Jam*_*e F 5

好像您错过了该LookupSet函数的第三个参数:

代替

=Join(
   LookupSet(
      Fields!PID.Value,
      Fields!PID.Value,
      Fields!Xtrnl_Award_Type_Code,
      "Awards"),
   ",")
Run Code Online (Sandbox Code Playgroud)

尝试这个:

=Join(
   LookupSet(
      Fields!PID.Value,
      Fields!PID.Value,
      Fields!Xtrnl_Award_Type_Code.Value,
      "Awards"),
   ",")
Run Code Online (Sandbox Code Playgroud)

(实际上,即使如此,字段名称也与您在示例中显示的名称不匹配。您可能需要将参数更改为 Fields!Xtrnl_Award_Type.Value