Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add INCLUDE header #7

Closed
jdorn opened this issue May 20, 2012 · 1 comment
Closed

Add INCLUDE header #7

jdorn opened this issue May 20, 2012 · 1 comment
Assignees
Milestone

Comments

@jdorn
Copy link
Owner

jdorn commented May 20, 2012

The INCLUDE header includes a file inside a report. This is useful for multiple reports that share common report code.

Example:

-- This is the included file (cars/includes/includes.sql)
-- VARIABLE: limit, Max Results

SET @product_category = 'cars';

{{#limit}}
SET @limit = {{limit}};
{{/limit}}
{{^limit}}
SET @limit = 100;
{{/limit}}
-- This is the main report (cars/list_of_products.sql)
-- INCLUDE: includes/includes.sql

SELECT * FROM Products WHERE ProductCategory = @product_category LIMIT @limit;

The include path is relative to the current report. The file extension is optional and will default to the file extension of the current report. All headers in the included report will be parsed and added to the existing headers of the current report. It is possible to have nested includes, but the include path is always relative to the current report.

The included report contents will be inserted at the beginning of the current report contents. If more than one INCLUDE header is present, the included report contents will be inserted in the order they appear in the headers.

@ghost ghost assigned jdorn May 20, 2012
@jdorn
Copy link
Owner Author

jdorn commented May 24, 2012

INCLUDE now works for the report content. I have to rethink including report headers due to some complications.

If an included report has a NAME header, we probably don't want to override the main report's NAME.

An included report can have "OPTION: noreport", which makes sense since you don't want to render the included report. However, you can't set this on the main report, or that would break things.

It would still be useful for VARIABLE, VALUE, CHART, and a few other headers. I need to think of some way to only include certain headers.

Closing for now, but may reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant