在 Tablix rdlc 中添加两个数据集的字段
Adding fields of two DataSets in a Tablix rdlc
我制作了两个名为 LedgerDetails 和 LedgerDetailsOB 的数据集。
LedgerDetailsOB 包含以下字段
Account_Code | Open_Bal | C_D
LedgerDetails 包含:
Account_Code | Date | Description | Amount
现在我在 DataSource 中与 Account_Code 建立了关系,认为它是否可以工作但没有工作。
我将 参数传递给 Account_Code 到报表,并使用该参数从存储过程中获取数据。它工作正常...
现在我想要 LedgerDetailsOB 的第一个数据显示出来,当它完成时,LedgerDetails 的数据从同一 table 的下一行继续。
我做的事情是:
第一行是 tablix 的 headers,第二行是来自 LedgerDetailsOB 的数据。
进入第 3 行并尝试从 LedgerDetails 添加数据,但它肯定会拒绝...
我搜索并找到写成表达式的 LOOKUP 函数,所以我也这样做了..
按照表达式,我尝试在 tablix 的第 3 行 运行:
=LOOKUP(Fields!Account_code.Value,Fields!Account_code.Value,Fields!Trans_Date.Value, "LedgerDetails")
并且上面的表达式在表达式框中没有错误行(红线)
之后,我清理项目并重建它,所以我得到以下错误。
The Value expression for the text box ‘Account_code’ refers to the
field ‘Account_code’. Report item expressions can only refer to
fields within the current dataset scope or, if inside an aggregate,
the specified dataset scope. Letters in the names of fields must use
the correct case.
注意:这是我工作的 subreport/childreport.. 仅供参考..
谢谢。
tablix 只能引用一个数据源。简单的解决方案是 "flatten" 您的数据,并将其组合成具有以下字段的单个 DataSet
:
Account_Code | Date | Description | Amount | Open_Bal | C_D
然后您可以按帐户代码和日期对行进行分组,而无需进行任何查找。
使用下面的 SQL 创建视图:
SELECT
OB.account_code,
OB.open_bal,
OB.C_D,
DT.date,
DT.description,
DT.amount
FROM
LedgerDetails AS DT,
LedgerDetailsOB AS OB
WHERE
OB.account_code = DT.account_code
我制作了两个名为 LedgerDetails 和 LedgerDetailsOB 的数据集。
LedgerDetailsOB 包含以下字段
Account_Code | Open_Bal | C_D
LedgerDetails 包含:
Account_Code | Date | Description | Amount
现在我在 DataSource 中与 Account_Code 建立了关系,认为它是否可以工作但没有工作。
我将 参数传递给 Account_Code 到报表,并使用该参数从存储过程中获取数据。它工作正常...
现在我想要 LedgerDetailsOB 的第一个数据显示出来,当它完成时,LedgerDetails 的数据从同一 table 的下一行继续。
我做的事情是:
第一行是 tablix 的 headers,第二行是来自 LedgerDetailsOB 的数据。
进入第 3 行并尝试从 LedgerDetails 添加数据,但它肯定会拒绝...
我搜索并找到写成表达式的 LOOKUP 函数,所以我也这样做了..
按照表达式,我尝试在 tablix 的第 3 行 运行:
=LOOKUP(Fields!Account_code.Value,Fields!Account_code.Value,Fields!Trans_Date.Value, "LedgerDetails")
并且上面的表达式在表达式框中没有错误行(红线)
之后,我清理项目并重建它,所以我得到以下错误。
The Value expression for the text box ‘Account_code’ refers to the field ‘Account_code’. Report item expressions can only refer to fields within the current dataset scope or, if inside an aggregate, the specified dataset scope. Letters in the names of fields must use the correct case.
注意:这是我工作的 subreport/childreport.. 仅供参考..
谢谢。
tablix 只能引用一个数据源。简单的解决方案是 "flatten" 您的数据,并将其组合成具有以下字段的单个 DataSet
:
Account_Code | Date | Description | Amount | Open_Bal | C_D
然后您可以按帐户代码和日期对行进行分组,而无需进行任何查找。
使用下面的 SQL 创建视图:
SELECT
OB.account_code,
OB.open_bal,
OB.C_D,
DT.date,
DT.description,
DT.amount
FROM
LedgerDetails AS DT,
LedgerDetailsOB AS OB
WHERE
OB.account_code = DT.account_code