Erich,
Thanks for the tip, but I’m afraid it doesn’t really answer my question:
shortcut joins do indeed allow joins to be used in function of the TABLES involved in the query, but what we’re looking for is a way of defining joins in function of the FIELDS involved in the query.
Perhaps I should clarify the example I mentioned in my initial message: initially I only mentioned 2 tables, without ‘lookup’ table (I assume this is the Dimension table you refer to in your message) – however, without a third ‘Dimension’ table it doesn’t seem possible at all to make the same selection on both tables without having to link 2 seperate queries. Thus, let’s assume that there is a Dimension table, but which does not include ALL possible combinations of the various Dimensions
-
3 tables, BUDGET and ACTUAL and LOOKUP, which all have the
following fields:
-
Name
-
Company
-
Product
-
FY
-
Quarter
-
Price
-
if I want to retrieve budgeted and actual revenue for a
particular Product during a certain Quarter, I would want to use the following joins
LOOKUP.FY=BUDGET.FY
LOOKUP.FY=ACTUAL.FY
LOOKUP.Quarter=BUDGET.Quarter
LOOKUP.Quarter=ACTUALS.Quarter
LOOKUP.Product=BUDGET.Product
LOOKUP.Product=ACTUAL.Product
- HOWEVER, to retrieve budgeted and actual revenue for a
particular Quarter, I only want to use the joins
LOOKUP.FY=BUDGET.FY
LOOKUP.FY=ACTUAL.FY
LOOKUP.Quarter=BUDGET.Quarter
LOOKUP.Quarter=ACTUALS.Quarter
as mentioned above, the lookup table does not include all possible combinations of the various dimensions: hence, if I would use the joins on Product as well, I’m bound to exclude some records by performing this query (namely, those records in BUDGET or ACTUAL which have a value in the Product field which does not exist in combination with the given FY and Quarter in the LOOKUP table)
It seems to me that the only solution will consist of creating a LOOKUP including all possible combinations of Dimension values…
mirko.
“Hurst, Erich” Erich.Hurst@COMPAQ.COM on 23-09-98 18:01:05
Please respond to Business Objects Query Tool BUSOB-L@LISTSERV.AOL.COM
Sent by: “Hurst, Erich” Erich.Hurst@COMPAQ.COM
cc: (bcc: Mirko Vonck/Cortex/Antwerp/BE/SGS)
Mirko,
My suggestion would be to look into “shortcut joins”. Consider the following scenario:
-
You have two tables in your database, a “master” and a “detail” table, let’s call them MAST and DET. They are joined through an arbitrary primary key field, say, ID.
-
You have a “dimension” table in your database, let’s call it DIM. This table can be joined to MAST and DET through field F1, but obviously you don’t need to join it to both when you have a join to MAST and DET.
In other words, if you build a query on DIM and MAST, you want the WHERE clause to look something like this:
WHERE DIM.F1 = MAST.F1 (1)
If you build a query on DIM and DET, you want the WHERE clause to look something like this:
WHERE DIM.F1 = DET.F1 (2)
And if you build a query on MAST and DET alone, you want the WHERE clause to
look something like this:
WHERE MAST.ID = DET.ID (3)
The problem is, if you create all three joins, when you build a query on all
three tables your WHERE clause would end up looking like:
WHERE DIM.F1 = MAST.F1 (1)
AND DIM.F1 = DET.F1 (2)
AND MAST.ID = DET.ID (3)
When all three tables are included you don’t need join (2) because you already have joins (1) and (3). You could just delete join (2), but if you did, BO would automatically include MAST in any queries you build on DIM + DET – and that is hardly ever desirable. So, the question is, is there a way to make join (2) variable.
With shortcut joins you can accomplish this. If you make join (2) a shortcut join, when you build a query on only DIM + DET, BO will only use join (2); but when you build a query on DIM + DET + MAST, BO will ignore join (2).
I hope I’ve done a good enough job of explaining shortcut joins.
Erich Hurst
Compaq Computer Corporation
Listserv Archives (BOB member since 2002-06-25)