Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

'enforce' option of joins in Crystal XI 1

Status
Not open for further replies.

kratz

Programmer
Nov 17, 2006
35
US
The blurb returned by Crystal's "help" talks about "enforce" as though the person asking what it means knows what it means. I don't.

1. Does "enforce" cause the machine to do more work in selecting records?
2. What difference does it make whether a join is enforced?

I have a report involving eleven tables. In most cases "inner join" is appropriate since there is always a corresponding row in the ;to; table. Two of the other 'to' tables warrant "left outer join"; and another is joined to one of three different tables depending on data values. So I'm wondering whether I should use "enforced both" on those joins where I know there has to be a corresponding row.
 
The help file looked pretty helpful to me.

Not Enforced
When you select this option, the link you've created is used only if it's explicitly required by the Select statement. Your users can create reports based on the selected tables without restriction (that is, without enforcement based on other tables). This is the default option.

Enforced From
When you select this option, if the to table for the link is used, the link is enforced. For example, if you create a link from TableA to TableB using Enforce From and select only a field from TableB, the Select statement will still include the join to TableA because it is enforced. Conversely, selecting only from TableA with the same join condition will not cause the join to TableB to be enforced.

Enforced To
When you select this option, if the from table for the link is used, the link is enforced. For example, if you create a link from TableA to TableB using Enforce To and select only a field from TableA, the join to TableB will be enforced, and the Select statement that is generated will include both tables.

Enforced Both
When you select this option, if either the from table or the to table for this link is used, the link is enforced.

 
Thank you for trying to help me ...

That's the description I have printed hoping it would illuminate me. But I perceive no clue what they mean by enforcement or "restriction".
Do they mean that, for example, if I linked table a to table b and table b to table c and the only reason to mention table b at all is because I need table b in order to get to table c (because table b contains a foreign key to table c which table a doesn't have) ... that table b can be "not enforced"?
Maybe I'm extraordinarily dense, but I don't understand this at all.
 
It just means that if you enforce a link anywhere, it will include that table in your query even if you're not retrieving any data from that table. In the case of your join example, even if you didn't enforce the join, your query would still need to include table b because of your foreign key requirement, in essence, enforcing the join on its own. Don't worry about being dense. We all had to learn something for the first time :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top