About Data Links



            Data Links are used to establish parent-child relationships between queries and groups via column matching. A data link can establish these relationships:
·         Between one query's column and another query's column.
·         Between one query's group and another query's group (this is useful when you want the child query to know about its parent's data).

A data link causes the child query to be executed once for each instance of its parent group. The child query is executed with the values of the primary key used by the parent.
When a report with a data link is executed, the data link is converted into a SQL clause (as specified in the link's Property Inspector) and appended to the child query if Reports Builder is able to parse the query.


Although links are commonly equijoins (for example, WHERE DEPTNO=DEPTNO), you can create links with various SQL clauses (that is, WHERE, HAVING, or START WITH) and conditions. If your database has database constraints, you can create a data link that derives its SQL clause and condition from the constraints. You can view the SELECT statements for the individual parent and child queries in Reports Builder, but cannot view the SELECT statement that includes the clause created by the data link you define.


Creating a data link
To create a data link:
1.      In the Data Model view, single-click the Data Link tool in the tool palette. A link is always drawn from the parent group to the child query.
2.      Create the link:
Create a Group to Group Link: To create a link between one query's group and another query's group, which is useful when you want the child query to know about the parent's data, click the parent group (avoiding the columns in the group) and drag a link to the child group.
Create a Column to Column Link: To create a link between columns, click a column of the parent query and drag a link to a column of the child query.
3.      Double-click the new link object to display the Property Inspector, and set the desired properties.