Crystal reports 当详细信息中不止指定参数时,显示所有详细信息
标题可能有点长/让人困惑,并且可能会产生误导,所以让我来设置场景Crystal reports 当详细信息中不止指定参数时,显示所有详细信息,crystal-reports,crystal-reports-2008,Crystal Reports,Crystal Reports 2008,标题可能有点长/让人困惑,并且可能会产生误导,所以让我来设置场景 Columns - {Table.FruitDesc} {Table.FruitColor} {Table.FruitQty} GH1a | Basket 1 | GH1b | Fruit | Color | Qty | GH1c |------------|--------|-----| Details | Strawberry | Red | 3 |
Columns - {Table.FruitDesc} {Table.FruitColor} {Table.FruitQty}
GH1a | Basket 1 |
GH1b | Fruit | Color | Qty |
GH1c |------------|--------|-----|
Details | Strawberry | Red | 3 |
... | Apple | Green | 1 |
... | Banana | Yellow | 9 |
<new set>
GH1a | Basket 2 |
GH1b | Fruit | Color | Qty |
GH1c |------------|--------|-----|
Details | Kiwi | Green | 1 |
... | Grape | Purple | 7 |
... | Plum | Red | 2 |
<new set>
GH1a | Basket 3 |
GH1b | Fruit | Color | Qty |
GH1c |------------|--------|-----|
Details | Apple | Green | 8 |
... | Kiwi | Green | 5 |
Columns-{Table.FruitDesc}{Table.FruitColor}{Table.FruitQty}
GH1a |篮子1|
GH1b |水果|颜色|数量|
GH1c|------------|--------|-----|
细节|草莓红| 3|
... | 苹果绿1|
... | 香蕉黄9|
GH1a |篮子2|
GH1b |水果|颜色|数量|
GH1c|------------|--------|-----|
详情|猕猴桃|绿色| 1|
... | 葡萄|紫| 7|
... | 李子|红| 2|
GH1a |篮3|
GH1b |水果|颜色|数量|
GH1c|------------|--------|-----|
细节|苹果|绿色| 8|
... | 猕猴桃|绿| 5|
现在让我们假设我有一个参数{?Fruit}
,我用它来显示所有可能的水果的列表
我希望将该参数传递给报表,并让它返回包含指定水果的篮子中的所有水果
类似于:{Table.FruitDesc}
中的{Fruit}-这不起作用
如果我要为{Fruit}
选择Apple
,我希望它返回Basket 1
和Basket 3
的所有结果,而不仅仅是Basket 1
和Basket 3
在细节中只显示Apple
行,因为这将抛出篮子大小的运行总数
换言之,我正在寻找所有包含Apple
的篮子,以及它们的实际大小和相关内容
希望我能解释清楚。您的要求是简单
,但实现是一项繁琐的任务
我的做法是:
不要在记录排序专家中使用{Table.FruitDesc}
中的{?Fruit},因为这将根据您的要求产生错误的结果
根据您的需要,您需要将水果的所有值存储在一个数组中,如下所示。创建公式@Add
Shared StringVar Array x;
x:=x+Fruit;
1
将上述公式放置在详图部分的最右侧。。。并压制它
现在转到GH1a
、GH1b
、GH1c
和Details
的专家部分,并编写一个suppress公式,以便当{Fruit}
在数组中时不suppress
,如果不存在suppress
EvaluateAfter{@Add};
Local NumberVar i;
Local BooleanVar a;
Shared StringVar Array x;
for i:=0 to count(x) do
(
if x[i]={?Fruit}
then
a:=true
else
a:=false
);
if (a=true)
then false //if true then don't supress.. here true means value in array
else true //if true then supress.. here false means value is not in array
如果{?Fruit}
列表中不存在,则上述公式将被禁用,否则将显示您可以通过创建一个公式(常规公式,而不是记录选择公式)来执行此操作,如:
然后,如果此公式的和等于0,则只需抑制组。换句话说,如果篮子中没有与参数匹配的水果,则抑制组:
// Suppression formula for your Basket group
if sum({@MatchFruit},{Table.BasketID})=0
// Suppression formula for your Basket group
if sum({@MatchFruit},{Table.BasketID})=0