RDLC Lookup无法正常工作

时间:2017-01-13 13:58:48

标签: winforms rdlc reportviewer

我有一个Table,其中包含一组带有整数的数据,用于标记在另一个dataset中查找其字符串描述的位置。我试过用:

=LOOKUP(
        CINT(Fields!LTC_Leak.Value),
        CINT(Fields!LTC_Leak.Value),
        Fields!LTC_LeakDesc.Value,
        "LeakCheckTypes"
        )

这应该使用详细信息LTC_Leak中的整数字段dataset,该表也是作用域的,并在"LeakCheckTypes" dataset中查找该行的描述,但我保留得到错误:

The Value expression for the text box 'LeakCheckType' refers to the field 'LTC_LeakDesc'. Report item expressions can only refer to fields within the current dataset scope or, if inside an aggregate, the specified dataset scope.

我已经使用调试器进行检查,所有datasets都存在,命名正确,并且拥有所有正确的数据。任何人都知道我在这里做错了什么?

从我使用的datasetmodel中添加xml(缩写为受影响的表)

    <xs:element name="Details" msprop:Generator_TableClassName="DetailsDataTable" msprop:Generator_TableVarName="tableDetails" msprop:Generator_RowChangedName="DetailsRowChanged" msprop:Generator_TablePropName="Details" msprop:Generator_RowDeletingName="DetailsRowDeleting" msprop:Generator_RowChangingName="DetailsRowChanging" msprop:Generator_RowEvHandlerName="DetailsRowChangeEventHandler" msprop:Generator_RowDeletedName="DetailsRowDeleted" msprop:Generator_RowClassName="DetailsRow" msprop:Generator_UserTableName="Details" msprop:Generator_RowEvArgName="DetailsRowChangeEvent">
      <xs:complexType>
        <xs:sequence>
          <xs:element name="Row" msprop:Generator_ColumnVarNameInTable="columnRow" msprop:Generator_ColumnPropNameInRow="Row" msprop:Generator_ColumnPropNameInTable="RowColumn" msprop:Generator_UserColumnName="Row" type="xs:string" minOccurs="0" />
          <xs:element name="OPRID" msprop:Generator_ColumnVarNameInTable="columnOPRID" msprop:Generator_ColumnPropNameInRow="OPRID" msprop:Generator_ColumnPropNameInTable="OPRIDColumn" msprop:Generator_UserColumnName="OPRID" type="xs:string" minOccurs="0" />
          <xs:element name="NAME" msprop:Generator_ColumnVarNameInTable="columnNAME" msprop:Generator_ColumnPropNameInRow="NAME" msprop:Generator_ColumnPropNameInTable="NAMEColumn" msprop:Generator_UserColumnName="NAME" type="xs:string" minOccurs="0" />
          <xs:element name="LTC_Cure" msprop:Generator_ColumnVarNameInTable="columnLTC_Cure" msprop:Generator_ColumnPropNameInRow="LTC_Cure" msprop:Generator_ColumnPropNameInTable="LTC_CureColumn" msprop:Generator_UserColumnName="LTC_Cure" type="xs:string" minOccurs="0" />
          <xs:element name="LTC_Leak" msprop:Generator_ColumnVarNameInTable="columnLTC_Leak" msprop:Generator_ColumnPropNameInRow="LTC_Leak" msprop:Generator_ColumnPropNameInTable="LTC_LeakColumn" msprop:Generator_UserColumnName="LTC_Leak" type="xs:string" minOccurs="0" />
          <xs:element name="LTC_VacuumCheck" msprop:Generator_ColumnVarNameInTable="columnLTC_VacuumCheck" msprop:Generator_ColumnPropNameInRow="LTC_VacuumCheck" msprop:Generator_ColumnPropNameInTable="LTC_VacuumCheckColumn" msprop:Generator_UserColumnName="LTC_VacuumCheck" type="xs:string" minOccurs="0" />
          <xs:element name="LTC_VacuumInterval" msprop:Generator_ColumnVarNameInTable="columnLTC_VacuumInterval" msprop:Generator_ColumnPropNameInRow="LTC_VacuumInterval" msprop:Generator_ColumnPropNameInTable="LTC_VacuumIntervalColumn" msprop:Generator_UserColumnName="LTC_VacuumInterval" type="xs:string" minOccurs="0" />
          <xs:element name="LTC_VacuumCheckType" msprop:Generator_ColumnVarNameInTable="columnLTC_VacuumCheckType" msprop:Generator_ColumnPropNameInRow="LTC_VacuumCheckType" msprop:Generator_ColumnPropNameInTable="LTC_VacuumCheckTypeColumn" msprop:Generator_UserColumnName="LTC_VacuumCheckType" type="xs:string" minOccurs="0" />
        </xs:sequence>
      </xs:complexType>
    </xs:element>

    <xs:element name="LeakCheckTypes" msprop:Generator_TableClassName="LeakCheckTypesDataTable" msprop:Generator_TableVarName="tableLeakCheckTypes" msprop:Generator_TablePropName="LeakCheckTypes" msprop:Generator_RowDeletingName="LeakCheckTypesRowDeleting" msprop:Generator_RowChangingName="LeakCheckTypesRowChanging" msprop:Generator_RowEvHandlerName="LeakCheckTypesRowChangeEventHandler" msprop:Generator_RowDeletedName="LeakCheckTypesRowDeleted" msprop:Generator_UserTableName="LeakCheckTypes" msprop:Generator_RowChangedName="LeakCheckTypesRowChanged" msprop:Generator_RowEvArgName="LeakCheckTypesRowChangeEvent" msprop:Generator_RowClassName="LeakCheckTypesRow">
      <xs:complexType>
        <xs:sequence>
          <xs:element name="LTC_Leak" msprop:Generator_ColumnVarNameInTable="columnLTC_Leak" msprop:Generator_ColumnPropNameInRow="LTC_Leak" msprop:Generator_ColumnPropNameInTable="LTC_LeakColumn" msprop:Generator_UserColumnName="LTC_Leak" type="xs:int" />
          <xs:element name="LTC_LeakDesc" msprop:Generator_ColumnVarNameInTable="columnLTC_LeakDesc" msprop:Generator_ColumnPropNameInRow="LTC_LeakDesc" msprop:Generator_ColumnPropNameInTable="LTC_LeakDescColumn" msprop:Generator_UserColumnName="LTC_LeakDesc">
            <xs:simpleType>
              <xs:restriction base="xs:string">
                <xs:maxLength value="20" />
              </xs:restriction>
            </xs:simpleType>
          </xs:element>
          <xs:element name="Leak_Tolerance" msprop:Generator_ColumnVarNameInTable="columnLeak_Tolerance" msprop:Generator_ColumnPropNameInRow="Leak_Tolerance" msprop:Generator_ColumnPropNameInTable="Leak_ToleranceColumn" msprop:Generator_UserColumnName="Leak_Tolerance" type="xs:decimal" minOccurs="0" />
          <xs:element name="LC_Length" msprop:Generator_ColumnVarNameInTable="columnLC_Length" msprop:Generator_ColumnPropNameInRow="LC_Length" msprop:Generator_ColumnPropNameInTable="LC_LengthColumn" msprop:Generator_UserColumnName="LC_Length" type="xs:int" minOccurs="0" />
          <xs:element name="VTA" msprop:Generator_ColumnVarNameInTable="columnVTA" msprop:Generator_ColumnPropNameInRow="VTA" msprop:Generator_ColumnPropNameInTable="VTAColumn" msprop:Generator_UserColumnName="VTA" type="xs:boolean" minOccurs="0" />
        </xs:sequence>
      </xs:complexType>
    </xs:element>

RDLC文件中的XML:

<DataSet Name="LeakCheckTypes">
  <Query>
    <DataSourceName>OprData</DataSourceName>
    <CommandText>/* Local Query */</CommandText>
  </Query>
  <Fields>
    <Field Name="LTC_Leak">
      <DataField>LTC_Leak</DataField>
      <rd:TypeName>System.Int32</rd:TypeName>
    </Field>
    <Field Name="LTC_LeakDesc">
      <DataField>LTC_LeakDesc</DataField>
      <rd:TypeName>System.String</rd:TypeName>
    </Field>
    <Field Name="Leak_Tolerance">
      <DataField>Leak_Tolerance</DataField>
      <rd:TypeName>System.Decimal</rd:TypeName>
    </Field>
    <Field Name="LC_Length">
      <DataField>LC_Length</DataField>
      <rd:TypeName>System.Int32</rd:TypeName>
    </Field>
    <Field Name="VTA">
      <DataField>VTA</DataField>
      <rd:TypeName>System.Boolean</rd:TypeName>
    </Field>
  </Fields>
  <rd:DataSetInfo>
    <rd:DataSetName>OprData</rd:DataSetName>
    <rd:SchemaPath>C:\Users\aridder\Desktop\AC Recipe Builder\AC Recipe Builder\OprReports\OprData.xsd</rd:SchemaPath>
    <rd:TableName>LeakCheckTypes</rd:TableName>
    <rd:TableAdapterFillMethod>Fill</rd:TableAdapterFillMethod>
    <rd:TableAdapterGetDataMethod>GetData</rd:TableAdapterGetDataMethod>
    <rd:TableAdapterName>LeakCheckTypesTableAdapter</rd:TableAdapterName>
  </rd:DataSetInfo>
</DataSet>

<DataSet Name="Details">
  <Query>
    <DataSourceName>OprData</DataSourceName>
    <CommandText>/* Local Query */</CommandText>
  </Query>
  <Fields>
    <Field Name="Row">
      <DataField>Row</DataField>
      <rd:TypeName>System.String</rd:TypeName>
    </Field>
    <Field Name="OPRID">
      <DataField>OPRID</DataField>
      <rd:TypeName>System.String</rd:TypeName>
    </Field>
    <Field Name="NAME">
      <DataField>NAME</DataField>
      <rd:TypeName>System.String</rd:TypeName>
    </Field>
    <Field Name="LTC_Cure">
      <DataField>LTC_Cure</DataField>
      <rd:TypeName>System.String</rd:TypeName>
    </Field>
    <Field Name="LTC_Leak">
      <DataField>LTC_Leak</DataField>
      <rd:TypeName>System.String</rd:TypeName>
    </Field>
    <Field Name="LTC_VacuumCheck">
      <DataField>LTC_VacuumCheck</DataField>
      <rd:TypeName>System.String</rd:TypeName>
    </Field>
    <Field Name="LTC_VacuumInterval">
      <DataField>LTC_VacuumInterval</DataField>
      <rd:TypeName>System.String</rd:TypeName>
    </Field>
    <Field Name="LTC_VacuumCheckType">
      <DataField>LTC_VacuumCheckType</DataField>
      <rd:TypeName>System.String</rd:TypeName>
    </Field>
  </Fields>
  <rd:DataSetInfo>
    <rd:DataSetName>OprData</rd:DataSetName>
    <rd:SchemaPath>C:\Users\aridder\Desktop\AC Recipe Builder\AC Recipe Builder\OprReports\OprData.xsd</rd:SchemaPath>
    <rd:TableName>Details</rd:TableName>
    <rd:TableAdapterFillMethod />
    <rd:TableAdapterGetDataMethod />
    <rd:TableAdapterName />
  </rd:DataSetInfo>
</DataSet>

0 个答案:

没有答案