Dynamic Parameter showing too many values

时间:2016-04-15 10:59:21

标签: sql-server join crystal-reports

I am currently creating a simple report in Crystal Reports with two tables:

{Table1.group_name_id} --> {Table2.technical_group_id}

Table 1 holds all of the groups; ID's, Names etc
Table 2 holds only the technical groups ID

With these two tables linked it means the only records that will return are those where technical groups are involved, perfect! But now I want to add a dynamic parameter to return the Technical Group Names for the End User to select.

Because {Table2} only holds one field (the ID) which links to {Table1}'s ID, I have to perform the Parameter selection on {Table1}'s name field.

But this is pulling back all of {Table1}'s names and is discounting the Join on {Table2} even with an enforced join present.

Is there a way to force it to only pull back {Table1}'s names as long as it matches the JOIN between {Table1} and {Table2}?

Thanks in advance!

Edit (additional information)

Table Link

2 个答案:

答案 0 :(得分:2)

正如我想的那样 - 问题是Crystal Reports在显示参数值时没有识别JOIN。

经过一些阅读后,我发现只有在将查询传递给数据库时才能识别JOINS(逻辑上)。因此,在选择参数时,它不会识别JOINS。

我通过创建自定义SQL命令来解决这个问题,强制它只撤回第二个表中的组。

答案 1 :(得分:0)

First, please confirm your join INNER JOIN.

enter image description here

For Addition, You can pass the User Input as a parameter in to the crystal report and use this {@Parameter} to filter the result set using SelectionFormula in Crystal Report.

Or you can even set the selectionformula itself from the application.

相关问题