Alias Tables for diamond relationships

Technical support

Moderators: Bob Cergol, Data Access, Cintac

Alias Tables for diamond relationships

Postby Bob Cergol » Mon Dec 21, 2009 9:19 pm

While the following is not really a true example of a diamond relationship, the impact is the same, and this sort of scenario is a fairly common occurrence in the database in my system:

Customers relate to Sales Reps (Jccust.Jcreps_Idno --> Jcreps.Idno)

Orders relate to Customers (Jcjobs.Cust_Idno --> Jccust.Idno)

Orders relate to Sales Reps, and can be a different rep than the order's customer relates to, (Jcjobs.Jcreps_Idno --> Jcorep.Idno) Jcorep being an alias of table Jcreps.

I'm playing around with defining in relations in DAI and wondering how I would do this -- in case I find I need to. In VDF you absolutely need to since the relationships tend to be "hard-coded".

I am also thinking it would be really nice for VDF developers to have a feature that would automatically generate all the relations in DAI that are defined in a workspace database or all the tables in a DF filelist.

Bob
User avatar
Bob Cergol
Certified Dynamic AI Professional
 
Posts: 359
Joined: Fri Dec 11, 2009 5:48 pm

Re: Alias Tables for diamond relationships

Postby Carsten Sørensen » Mon Dec 21, 2009 9:34 pm

Hi Bob,

For "relationship definitions" used for linking (i.e. Dynamic AI relations - drill-to and subform inserts) I think you would set up each relationship individually and pick the ones that you need - however it might be that you would have to drill-several times to get to the information. Some scenarios could carry higher level filter parameters as well - restricting to the information needed - depending on the data-sources used though.

However it might be that you can set up the hierarchy using join-builder and get the complete picture in one data-source. Like a "waterfall" type of definition I guess..

Is there a way where you can give me a sample of some data? E.g.: a few sample records in Excel - then I'll be happy to investigate the best way. You can send me the sample data on cs@cintac.com.

Thanks!

Best regards,
Carsten
User avatar
Carsten Sørensen
Certified Dynamic AI Professional
 
Posts: 304
Joined: Thu Aug 16, 2007 1:25 pm
Location: Copenhagen

Re: Alias Tables for diamond relationships

Postby Eddy Kleinjan » Mon Dec 21, 2009 9:49 pm

Hi Bob,

You can handle this situation in Dynamic by include the base table (your alias table) twice in the query. When using the Dynamic AI Join Builder, you include the table twice and base the join on the underlying tables.

In case you would like to use a Dynamic AI SQL View, then you need to define alias names for the tables that occur more than once. Like:

Code: Select all
SELECT
    ...
FROM
    Jcjobs
    LEFT OUTER JOIN Jccust ON Jcjobs.Cust_Idno = Jccust.Idno
    LEFT OUTER JOIN Jcreps ON Jccust.Jcreps_Idno = Jcreps.Idno
    LEFT OUTER JOIN Jcreps Jcorep ON Jcjobs.Jcreps_Idno = Jcorep.Idno


Note the last LEFT OUTER JOIN where the Jcreps table is included again, but under the (alias) name Jcorep.

Hope this helps.

Eddy Kleinjan
User avatar
Eddy Kleinjan
Certified Dynamic AI Professional
 
Posts: 29
Joined: Thu Sep 13, 2007 12:10 pm
Location: Hengelo, Netherlands

Re: Alias Tables for diamond relationships

Postby Bob Cergol » Tue Dec 22, 2009 3:30 pm

Thanks Eddy,

That's pretty simple and basically the same as I'm used to.
User avatar
Bob Cergol
Certified Dynamic AI Professional
 
Posts: 359
Joined: Fri Dec 11, 2009 5:48 pm


Return to Technical Support

cron