Print Page | Close Window

Understanding Union All

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22465
Printed Date: 29 Apr 2024 at 5:17pm


Topic: Understanding Union All
Posted By: Coreysan
Subject: Understanding Union All
Date Posted: 28 Sep 2017 at 6:00am
I am new to CR XI, and am looking at reports another employee wrote years ago.

In one report, there is a parameter where you can choose one or more categories to report on, from a total list of 23 categories.

When I clicked on "Show SQL Query" I was expecting to see something like 23 conditional tests, but the T-SQL I get just shows all 23 selects concatenated with the UNION ALL.

So how does CR know which select to choose?

I looked at the selection expert, and it has 7 lines:

{Command.Category} = {?Category} and
{Command.STATUS} = {?Status} and
(
    {?MyCodes} = "ALL"
    OR
    {Command.THECODE} = {?MyCodes}
)

That's it! Nothing more. No formulas, and no SQL Expression Fields.

Thanks in advance for any advice!



Replies:
Posted By: kevlray
Date Posted: 28 Sep 2017 at 10:21am
The 23 selects will result in one dataset.  From that further filtering will be done with the selection expert on the that dataset.  In a sense Crystal Reports is not aware of the 23 selects, it just sees the one dataset that is returned from the command.



Print Page | Close Window