- Print
- PDF
Sub-reports and Query links are accessible through the Query links feature located in Lasernet > Common > Reports.
Query links enable users to combine multiple Queries and maintain and reuse a Query for multiple reports. This is useful if the same information from a particular Query is needed on multiple reports, such as CompanyInfo.
Query links work similarly to subreports but offer better performance, especially if the subreport is used at the line/details level.
Query links can be added through the Query wizard using the Copy/Link query option. Alternatively, existing subreports can be converted into Query links from within the Structure using the Convert to query link option.
Example - Add a Query Link Using Copy/Link Query
Scenario: The Query FPCompanyInfo contains the company information (data sources/tables):


Follow these steps:
Locate the Replacement report/Query for which FPCompanyInfo should be used/linked. The report SalesPackingSlipReplacement and the FPCompanyInfo are linked to the data source/table CustPackingSlipJour.
Open the Query wizard, click Copy/Link query when selecting Tables, and choose to which table the Query should be linked.

Select or enter the Query name FPCompanyInfo in the field Source report.

Toggling the Link (updates query on source change) button to Yes will create a reference to the Query (instead of just copying the Query) and ensure the following options become available:
Options | Description |
---|---|
Link (updates query on source change) | No: The Query is copied into an existing Query. Yes: A link/reference is created. |
Keep original output names | Used to preserve the layout/naming from the linked Query (Layout: Min, Medium, Max). |
Synchronize custom elements | Used to synchronize/update custom elements (in yellow). |
Create an element for the main query | Used to make the Query name part of the output. |
A link to the Query FPCompanyInfo is now added to the Query – Query_1 (Linked from FPCompanyInfo) is a link to a Query and not a copy:

Toggling the Link (updates query on source change) button to No will create a copy instead of a link to the Query:

Example - Convert a Subreport Using Convert to Query Link
Scenario: Your Query contains the following company information:


This Query is used as a subreport in the SalesInvoiceReplacement Query.
Follow these steps:
Open the Structure for the SalesInvoiceReplacement Query and identify the subreport element.

Click Tools > Convert to query link.

This converts the subreport into a Query link. The structure of the subreport is added to the structure of the SalesInvoiceReplacement.

And the existing subreport element is automatically made invisible by setting the Code condition on the element to 0.

Navigate to the SalesInvoiceReplacement’s Query Links option on the Action pane of the Reports page. Here, you can see the subreports and Query links associated with the host report.


Open the Query wizard for the SalesInvoiceReplacement. The Query link is visible and configurable through the Query wizard Copy/Link query option.


Now that the subreport has been added as a Query link, ensure that all patterns/rearranges are properly mapped in the Lasernet form design.