dbr.report
- Create a link to another reportdbr.url
- Create a link to an external URLdbr.button
- Create a button containing a linkdbr.list
- Create a list containing a link to a reportdbr.embed_object
- Create a placeholder or a popup window for the linked report's contentdbr.selectlist
- Create a select list for linked reportsdbr.searchable
- Create a search field to get dynamic content
select 'dbr.report', procedure_name, [ColumnReference, ] [embed_target, ] [parameter_name=ColumnReference/ParameterReference, ...] [parameter_name*=ColumnReference/ParameterReference, ...] [parameter_name<=ColumnReference/ParameterReference, ...]
[parameter_name="constant", ...] [,event=click|dblclick] [,callbefore=callbefore_function] [,append=url_parameter] [,'"menu title"'] [,show_link=expression] [html5-data-attribute] [,http_method=post], [callpopupclose=popupclose_function], [callpopupsubmit=popupsubmit_function]
[plain_URL=1]
select 'dbr.url', external_url_base, 'URL name', [ColumnReference, ] [embed_target, ] [<=ColumnReference/ParameterReference to be added to base URL] [parameter_name=ColumnReference/ParameterReference, ...]
select 'dbr.button', [button text / ColumnReference ], [button class], [button wrapper class]
select 'dbr.list', [list_class], [menutitle]
select 'dbr.embed_object', embed_target [, embed_class]
select 'dbr.selectlist', default_selection, title[, 'find' [, select_class]]
select 'dbr.searchable', procedure_name[, 'placeholder text' [parameter_name=ColumnReference/ParameterReference, ...]]
Where:
row
. In that case, the report is attached to the whole row. Any cell, except those containing other linked reports, will act as the starting point for the report.
&cancel_button=1
to the link.
There are also special targets available, such as popup_parameter
(which opens the linked report's parameter in a popup before changing the page)
and popup_parameter_new_window
(which opens the linked report's parameter in a popup before opening the linked report in a new window).
For more information, please refer to the Output destination of the linked report.
parameter_name=ColumnReference/ParameterReference
The user is not allowed to change the parameter (p-parameter), nor is it shown in the parameter query form
parameter_name<=ColumnReference/ParameterReference
The parameter becomes editable (e-parameter) to the user in the parameter query form
parameter_name+=ColumnReference/ParameterReference
The parameter becomes editable (u-parameter) in the URL. The parameter is also editable in parameter form if there are parameters that trigger the parameter form (e-parameters or missing parameters)
parameter_name*=ColumnReference/ParameterReference
The parameter is visible in the parameter query form (s-parameter), but the user is now allowed to change the parameter value
parameter_name="Constant"
Pass a constant value to the parameter (p-parameter)
callbefore
parameter is used when user confirmation is required before executing the linked report.
For instance, if the linked report deletes the row where the user clicked, the function can prompt a delete confirmation.
dbr.javascript
or a function included in a file) or an anonymous function definition.
dbr.javascript
or a function included in a file) or an anonymous function definition.
user/userstyle.css
file or in the report using dbr.html
. When the special value 'popup' is used, the placeholder becomes a popup window, enabling the use of multiple separate popups within a report.
One of the powerful features of myDBR is the ability to link reports, enabling drill-down functionality. Linked reports can be attached to any object in a report, such as a column, table, chart, or graph, and can point to another report or an external web page.
Linked reports can also be embedded in an existing report using an embedded element or a popup window.
This allows for quick drill-down content without the need for users to switch between reports,
and the linked report's content is fetched dynamically. To embed a linked report, you need to set the embed_target
parameter.
The linking process begins with the dbr.report
command (or dbr.url
for external sources),
followed by a standard result set. When the dbr.report
command is used,
the linked report is attached to the next result set. The parameters of the dbr.report
command define the linked report,
including where it's attached, where the content is displayed, and any required parameters.
Linking to an external URL using dbr.url
follows a similar process to dbr.report
with the distinction that it requires defining the visible name of the URL.
Basic use of linking:
select 'dbr.report', 'sp_DBR_film'; select Title, fid from mydb.film_list
The linked report is a stored procedure that may have parameters. These parameters can be derived from the incoming parameters of the original report and/or the data displayed in the report. If the linked report has parameters that are not populated during the linking process, they will be prompted from the user.
Adding a parameter to a linked report: In this case, 'inFilmID' is a parameter for the 'sp_DBR_film' stored procedure.
select 'dbr.report', 'sp_DBR_film','inFilmID=fid'; select Title, fid from mydb.film_list
By default, a linked report will be attached to the object via a link-menu (the user sees an
icon).
For tabular reports, you can also attach the link directly to a column by specifying the ColumnReference
as a parameter."
A linked report is attached to the first column
select 'dbr.report', 'sp_DBR_film', '[Title]', 'inFilmID=fid'; select Title, fid from mydb.film_list
By default, a linked report will execute and display in the user's browser. Users can navigate between reports using the browser's back and forward buttons.
The content of the linked report can also be embedded in the current report using either a fixed embed element or a movable popup window. This approach streamlines navigation for users who need additional information without switching between separate reports.
Alternatively, the output destination can be set to open in a new browser window using the predefined value 'new_window', or as a dynamic popup with 'new_popup'.
The embed_target
parameter can also include column references using [ColumnReference] notation, enabling multiple dynamic embeds simultaneously.
The embed_target
parameter supports the following formats:
dbr.embed_object
command.
When the user clicks the link, the content of 'mytarget' is replaced with the new content.
dbr.embed_object
command. Most suitable in cases where a linked report returns nothing or returns JavaScript not visible to the user.
popup
will open a popup dialog for content
new_popup
will open a new popup dialog for each individual linked window
new_window
will open a link into new browser window
parent_window
will open a link into the parent window (can be used with iframe)
top_window
will open a link into the topmost window (can be used with multiple iframes)
dbr.embed_object
, it will be dynamically created at the end of the report.
Using dbr.embed_object
, you can determine its placement.
inline
, the linked report will display in a row below the linked row in a table report.
A new row is added to the table where the linked report's content is shown. This link type is specifically available for table reports.
Use this when you need to quickly open additional information from a row without losing the user context from the main report.
myid2012
inside mytarget
.
The myid
element ensures the ID is unique. If myid2012
has not been created using dbr.embed_object
, it will be dynamically created.
myid2012
target. For example, using the 'kwn' class (keepwithnext) will make linked elements appear side by side inside the mytarget
element.
popup_parameter
. If a linked report has user-enterable parameters, they will be requested using a popup window. The linked result will be shown in a new page. This should only be used with a report that has parameters. If used with a linked report that has no parameters, the result will be shown in a popup.
popup_parameter_new_window
prefix. If the linked report contains parameters that need to be entered by the user, these parameters are requested in a popup window, and the linked report opens in a new window. Use this when you anticipate that the user might cancel the report after viewing the parameter dialog, ensuring they remain within the main report context.
embedded_report_
prefix. The linked report is embedded within the current report. If the linked report has parameters that need to be entered by the user, the parameter form is displayed within the report. Use this when you want to include another report into an existing report, allowing users to rerun the embedded report with different parameters.
Links can be made optional by adding a 'show_link' parameter to the command. This parameter can be any valid PHP expression, including ColumnReferences. If the expression evaluates to true, the link is shown; otherwise, it is not displayed.
Examples of show_link
include: 'show_link=[myColumn]=="disable"', 'show_link=[myColumn]' or 'show_link=[myColumn]>10'.
Links can also be made optional by adding the no_link
option to the 'rowclass' or 'cellclass'. Rows or cells with this class will not have links attached. Using 'no_link' will disable all links to the defined row.
We have a film list from which we want to pick one film and obtain more details from it.
The film list is shown with a simple query:
select Title, fid from mydb.film_list
The report (sp_DBR_film
) showing the details and to which we wish to link an existing report, has one parameter inFilmID
, which represents the film's ID.
create procedure sp_DBR_film ( inFilmID int ) begin select description, release_year from mydb.film where film_id = inFilmID; end
Then, we can link the sp_DBR_film
report to the existing report using the dbr.report
command and provide the parameter inFilmID
with a value taken from the user's selected row's second column.
select 'dbr.report', 'sp_DBR_film','inFilmID=fid'; select Title, film_id from mydb.film;
When the original report is executed, the user will see a mark indicating a linked report: When clicked, this mark presents a list of linked reports. The name shown in the list is the name given to the report when it was added to myDBR. Therefore, the linked report must be added to myDBR for it to appear in the linked report list.
The list of linked reports shown in the pull-down menu depends on the user's permissions, displaying only those reports the user has access to.
Linked reports can have multiple parameters, including values from the original report's parameters. In many drill-down report scenarios, certain parameters need to be carried over to the next report. The following example illustrates this:
The original report has a couple of parameters:
create procedure sp_DBR_rentals ( inStartDate date, inEndDate date) begin select s.first_name, s.last_name, count(*), s.staff_id from mydb.rental r join mydb.staff s on s.staff_id=r.staff_id where r.rental_date between inStartDate and inEndDate group by s.first_name, s.last_name, s.staff_id; end
The linked report has also parameters:
create procedure sp_DBR_rentaldetail ( inStaff_id int, inStartDate date, inEndDate date ) begin select r.customer_id, r.inventory_id, r.rental_date from mydb.rental r where r.rental_date between inStartDate and inEndDate and r.staff_id = inStaff_id; end;
To link the report sp_DBR_rentaldetail
to be called from sp_DBR_rentals
, we need to add that link and define the parameters:
create procedure sp_DBR_rentals ( inStartDate date, inEndDate date) begin select 'dbr.report', 'sp_DBR_rentaldetail','inStaff_id=staff_id', 'inStartDate=(inStartDate)', 'inEndDate=(inEndDate)'; select s.first_name, s.last_name, count(*), s.staff_id from mydb.rental r join mydb.staff s on s.staff_id=r.staff_id where r.rental_date between inStartDate and inEndDate group by s.first_name, s.last_name, s.staff_id; end
The inStaff_id
parameter will get its value from the staff_id
column in the result set, while the dates are carried over from the original parameters (parameter names in parentheses).
When using an embedded element, a dbr.embed_object
command needs to be used to create the placeholder for the linked report's content. If the embed object contains a CSS class no_highlite
, the default yellow flashing highlight effect is not applied.
The content of the linked report will be displayed within an embedded element positioned after the original data.
-- Will not use yellow highlite select 'dbr.embed_object','shared_embed', 'no_highlite'; select 'dbr.embed_object','embed_with_id'; -- Will open the link to predefined 'popup' select 'dbr.report', 'sp_DBR_link_location_drill', 'popup', '[shared_popup]', 'inID=ID'; -- Will open the link always to new popup. No need to declare the new_popup select 'dbr.report', 'sp_DBR_link_location_drill', 'new_popup', '[new_popup]', 'inID=ID'; -- Will open the link to popup with ID. No need to declare the popup select 'dbr.report', 'sp_DBR_link_location_drill', 'popup[ID]', '[popup_id]', 'inID=ID'; -- Will open the link always to same embedded object. We declared shared_embed select 'dbr.report', 'sp_DBR_link_location_drill', 'shared_embed', '[shared_embedded]', 'inID=ID'; -- Will open the link inside an embedded object (ID). We declared the placeholder embed_id select 'dbr.report', 'sp_DBR_link_location_drill', 'embed_id.target[ID].kwn', '[embedded_id]', 'inID=ID'; -- Will open the link always to new window select 'dbr.report', 'sp_DBR_link_location_drill', 'new_window', '[new_window]', 'inID=ID'; -- Will open the parameter form in a popup and open redirect the user to the linked report select 'dbr.report', 'sp_DBR_film_detail', 'popup_parameter', '[popup_redirect]', 'inID=ID'; -- Will open the parameter form in a popup and open the linked report in a new window select 'dbr.report', 'sp_DBR_film_detail', 'popup_new', '[popup_new]', 'inID=ID'; -- Will embed the report (including parameter form into the current report) select 'dbr.report', 'sp_DBR_film_detail', 'embedded_report_film_detail', '[embed_report]', 'inID=ID'; select film_id as 'ID', 'Shared popup' as 'Shared popup[shared_popup]', 'Always new popup' as 'New popup[new_popup]', 'Popup by ID' as 'Popup by ID[popup_id]', 'Shared embedded' as 'Shared embedded[shared_embedded]', 'Embedded by ID' as 'Embedded by ID[embedded_id]', 'New window' as 'New window[new_window]', 'Ask parameters in this report - redirect to new' as 'Popup - Redirect[popup_redirect]', 'Ask parameters in this report - open in new window' as 'Popup - New[popup_new]', 'Embedded report' as 'Embedded report[embed_report]' from film limit 10; select 'dbr.embed_object','embedded_report_film_detail';
The syntax of dbr.url
is similar to dbr.report
. The difference in usage is that external URLs do not have permissions, so all external links are available to all users.
We'll assign a URL to the email column (third parameter for dbr.url
) of the query. The second parameter (URL name) is used when the URL is displayed in a menu (multiple linked reports attached to a column or no link position column is specified). Data from rows can be embedded into the URL by adding ColumnReference inside brackets in the external_url_base
.
select 'dbr.url', 'https://www.mydbr/forums/topic.php?id=[topic_id]#post[topic_last_post_id]', 'Show topic', '[email]'; select u.topic_title as 'Title', u.user_email as 'email, t.topic_id, t.topic_last_post_id from forums.bb_topics t join forums.bb_users u on u.ID = t.topic_last_poster order by topic_time desc
Will produce URL: https://mydbr.com/forums/topic.php?id=158#post-686 when user clicks a email-column in a row where topic_id=158 and topic_last_post_id=686.
You can also assign linked reports to charts by connecting the report to a chart element (bar/line/node).
The Premium/OEM version's charts support an unlimited number of linked reports per chart.
The following table represents the supported linking in charts:
Chart type | Chart command | ChartDirector | ChartJS | Graphviz |
---|---|---|---|---|
Column | column | C L | C L | |
3D Column | column3d | C L | ||
Multi-Series column | mscolumn | C L | C L | |
3D Multi-Series column | mscolumn3d | C L | ||
Stacked Column | stackedcolumn | C L | C L | |
3D Stacked Column | stackedcolumn3d | C L | ||
Stacked Bar | stackedbar | C L | C L | |
3D Stacked Bar | stackedbar3d | C L | ||
Stacked Area | stackedarea | C L | ||
3D Stacked Area | stackedarea3D | C L | ||
Line | line | C L | C L | |
3D line | line3d | C L | ||
Multi-Series Line | msline | C L | C L | |
Spline | spline | C L | C L | |
Pie | pie | C L | C L | |
3D Pie | pie3d | C L | ||
Bar | bar | C L | C L | |
3D Bar | bar3d | C L | ||
Multi-Series Bar | msbar | C L | C L | |
Area | area | C L | C L | |
3D Area | area3d | C L | ||
Multi-Series Area | msarea | C L | ||
Donut | donut | C L | C L | |
3D donut | donut3d | C L | ||
Multi-Series Column Line Double Y | mscolumnlinedy | C L | ||
3D Multi-Series Column Line Double Y | mscolumnlinedy3d | C L | ||
Meter | meter | C | ||
Hierarchy | hierarchy | C L | ||
Diagram | diagram | C L | ||
C ... Chart supported, L ... Linking supported |
Charts are always based on a single selection set. Linked reports are associated with specific rows from this result set.
Let's consider a simple scenario where a report is linked to a pie chart. The report itself is straightforward:
select 'dbr.report', 'sp_DBR_LinkedReport', 'vCode=code'; select 'dbr.hidecolumns', 'code'; select 'dbr.chart', 'pie'; select "First", 10, 1 as '[code]' union select "Second", 21, 2 union select "Third", 35, 3 union select "Fourth", 44, 4;
The report has a result set with three columns: text expression, value, and a key ID. The linked report is called with the invisible key ID (column 'code').
The report will produce a pie chart with a linked chart attached to the slices. Column references (like vCode=code), refer to the particular row the user clicks ("Second" -> vCode's value becomes 2)
Sometimes, when designing a report network and needing to link to a single report, using a button link is the most straightforward approach.
A button link functions like a standard HTML button and provides a direct link to the desired report with predefined parameters.
The syntax of a button link is similar to a normal linked report, with the addition of the dbr.button
command.
The button text can include the linked report's name, custom text defined in the dbr.button
command, or a column reference when generating multiple buttons.
By default, the CSS class for the button is 'button'. You can add or replace this with your own class definition using a second parameter for the dbr.button
command.
The button element is wrapped in a wrapper DIV, which can be styled using the third wrapper class parameter.
Here's an example of making a button link to a customer given as a parameter:
select 'dbr.report', 'sp_DBR_Customer', 'inCustomerID=1'; select 'dbr.button', 'Show customer info'; select vCustomerID;
This will create a button-link to the sp_DBR_Customer
report, passing the 'vCustomerID' as input (mapped to the inCustomerID
parameter in the sp_DBR_Customer
report).
An example of this can be seen in the demo database.
A linked report can also be associated with a select list. In this example, a linked report is triggered when the user selects an item from the list.
select 'dbr.report', 'sp_DBR_show_continent', 'inContinent=Continent'; select 'dbr.selectlist', 'Europe', 'Select title', 'find'; select distinct Continent from demo_country;
This will create a select list with an attached linked report. The sp_DBR_show_continent
report will be executed when the user selects an item from the list.
A list link is primarily used with embedded reports, where the visible text of each list item corresponds to the first column of the result set.
List links can be styled using user-defined CSS classes in user/userstyle.css
. myDBR includes two example styles: 'hlist' for horizontal lists and 'vlist' for vertical lists. These styles can serve as a basis for users to create their own custom definitions.
Here's an example of creating a list-link to display the list of continents. In this example, the second column (sum(Population)) determines the sorting order of the list items.
select 'dbr.report', 'sp_DBR_list_example', 'continent', 'inContinent=Continent'; select 'dbr.list', 'hlist'; select Continent, sum(Population) from demo_country group by Continent order by 2 desc; select 'dbr.embed_object', 'continent';
This will generate a list of horizontal links and the content of the linked report will be shown in the 'continent' object.
Here's an example where the list is displayed as a menu. By providing the menu title as a second parameter, the list is formatted as a menu.
select 'dbr.report', 'sp_DBR_list_example', 'continent', 'inContinent=Continent'; select 'dbr.list', 'hlist', 'Select continent'; select Continent, sum(Population) from demo_country group by Continent order by 2 desc; select 'dbr.embed_object', 'continent';
This will generate a list of horizontal links and the content of the linked report will be shown in the 'continent' object.
Clicking the menu expands it for selection:
The dbr.searchable
command creates a searchable field, allowing users to dynamically fetch report output by typing search terms.
Here's an example demonstrating the use of dbr.searchable
to fetch dynamic content. The user's search term automatically populates the first parameter. Additionally, dbr.searchable
can be used to find items to add to the current selection.
select 'dbr.searchable', 'sp_DBR_search_data', 'Filter text', 'in_id=id'; select 2 as 'id';
The search report can be a full myDBR report. In the example we just search for single sample data.
create procedure sp_DBR_search_data( in_search varchar(30), in_id int ) begin select 'dbr.title', ''; select 'dbr.search', 0; select title as 'Title', description as 'Description' from film where title like concat('%', ifnull(in_search,""), '%') or description like concat('%', ifnull(in_search,""), '%') limit 10; end
You can make a link optional by adding a show_link
parameter. This parameter accepts any PHP expression with column references. If the expression evaluates to true, the link is displayed; otherwise, it is hidden.
select 'dbr.report', 'sp_DBR_show_data', 'inID=ID', 'show_link=[Value]>0'; select ID, Name, Value from mydata;
The [Value] for the first row evaluates to 0 resulting in a false expression "0>0". The link is not shown for the first row.
You can create a download link that allows users to download the linked report in a supported export format by using the 'append' parameter.
Here's an example of downloading an Excel report without any additional parameters:
select 'dbr.report', 'sp_DBR_data', 'append=&export=xlsx'; select 'placeholder;
Create a download link for an Excel report that prompts for parameters in a popup window before initiating the download. Use a dynamic div[]
to indicate myDBR to utilize Ajax for fetching the file.
SELECT 'dbr.report', 'sp_DBR_single', 'div[]', 'append=&export=xlsx'; select 'placeholder;