Passing HTML into the page

Commands

dbr.html - Pass HTML directly into the report
dbr.purehtml - Same as dbr.html, kept for compatibility
dbr.html: - Include HTML into a string
dbr.purehtml: - Same as dbr.html:, kept for compatibility
dbr.javascript - Include Javascript code in the report
dbr.css - Include CSS definitions in the report
dbr.head - Include tags into HTML head part
dbr.file - Include a HTML file into the report
dbr.redirect - Do a server side 302 redirect to another page. Uses the same syntax as dbr.report
dbr.http.get - Make a HTTP GET requests and optionally return the result
dbr.http.post - Make a HTTP POST requests and return the result

Syntax

select 'dbr.html', 'HTML statement'
select 'dbr.purehtml', 'HTML statement'
select 'dbr.html:HTML statement'
select 'dbr.purehtml:HTML statement'
select 'dbr.javascript', 'javascript code' [, 'onload']
select 'dbr.css', 'css'
select 'dbr.head', html_tags
select 'dbr.file', path_to_file
select 'dbr.redirect', URL | report [, param1,[ ,param2]]]
select 'dbr.http.get', URL [, 'silent']
select 'dbr.http.post', URL [params..[, 'silent']]

Explanation

By default, if you include HTML tags in the report, myDBR will escape those tags. With these commands, myDBR lets the browser render the selected HTML-code.

With the dbr.html-command you can allow the client browser to render the HTML. The dbr.html-command makes the whole result set to be passed directly to the browser, as with the dbr.html:-syntax this allows mixing HTML within the query. The dbr.html: allows HTML formatting inside the result table's cell.

You can also pass Javascript code with 'dbr.javascript'. The command is a short version of 'dbr.html' and adds script tags around the parameter. The optional 'onload'-parameter makes the script run after the DOM-tree has been loaded Adding your own CSS can be done with 'dbr.css' which works similarly.

This allows the report author to include any content in the report and also to affect the layout of the report.

Example - dbr.html

Putting a logo in the left top corner of the report. Embed Google Maps map and YouTube video side by side in a report.

select 'dbr.title', ''; /* We do not need the title */

/* Putting up the logo. We'll use a predefined left div */
select 'dbr.html', '<div class="left"><img src="http://mydbr.nocsos.com/images/nocsos-logo.png"></div>'; 

/* Use this as title */
select 'dbr.hideheader';
select 'BMW F1 vs, BMW M5';

/* Put map and video side by side. 1st column */
select 'dbr.html', '<table align="center"><tr><td>'; 

select 'dbr.hideheader';
select 'Google map: Rockingham Race Track';

/* We have the Google Map URL here */
select 'dbr.html', RockinghamURL
from mydb.Racetracks;

/* 2nd column */
select 'dbr.html', '</td><td>'; 

select 'dbr.hideheader';
select 'Video: Fifth Gear';

/* We have the YouTube video URL here */
select 'dbr.html', F1vsM5URL
from mydb.Videos;

/* Close the table */
select 'dbr.html', '</td></tr></table>';

The report will position the logo on the top left. Map and video will appear side-by-side:

Example - 'dbr.html:'

The report will output a list of parts and their picture.

select 'Part 1' as 'Part name', 
       'WDC-2345-1' as 'Code', 
       'dbr.html:<img src="http://www.mysite.com/parts/WDC-2345-1.jpg">' as 'Preview'
union
select 'Part 2', 
       'WDC-2345-2', 
       'dbr.html:<img src="http://www.mysite.com/parts/WDC-2345-2.jpg">'
union
select 'Part 3', 
       'WDC-2345-3', 
       'dbr.html:<img src="http://www.mysite.com/parts/WDC-2345-3.jpg">';

The report will output a normal myDBR report list. myDBR will just put the indicated picture in the third column's cell.

Example - 'dbr.head'

You can include your own tags into HTML HEAD section with dbr.head

select 'dbr.head', '<meta property="og:url" content="http://mydomain.com/index.htm">';
select 'dbr.head', '<meta name="twitter:card" content="summary_large_image">';
select 'dbr.head', '<meta name="twitter:card" content="summary_small_image">';

'dbr.redirect' with the OEM license

The OEM license allows for you to use dbr.redirect to redirect page to another page with server side 302. The syntax is the same as in dbr.report. The command takes a single line as a result set. The redirect is useful when handling forms with Post/Redirect/Get pattern where the page handling the POST, redirects the page to another page after it has handled the POST.

select 'dbr.redirect', 'sp_DBR_landing_page', 'inInt=par', 'append=&hdr=0'

select 12345 as 'par'; 

'dbr.head' head with the OEM license

The OEM license allows for you to set dynamic title element

select 'dbr.head', concat('<title'>', thetitle, '</title'>');

Example - 'dbr.head'

You can include your own tags into HTML HEAD section with dbr.head

select 'dbr.head', '<meta property="og:url" content="http://mydomain.com/index.htm">';
select 'dbr.head', '<meta name="twitter:card" content="summary_large_image">';
select 'dbr.head', '<meta name="twitter:card" content="summary_small_image">';

Example - 'dbr.http.get' and 'dbr.http.post'

Commands allow for you to make HTTP POST and HTTP GET calls and optionally return results.

A HTTP POST call. The call shows the data returning from the call.

select 'dbr.http.post', 'https://financial_system/entry.php?action=cost',  'Purchase' as 'title', 200 as 'amount';

A silent HTTP POST call. The call is made and no data is shown. After silent call one can do a redirect. Can be used for example on form handling.

select 'dbr.http.post', 'https://financial_system/entry.php?action=cost',  'Purchase' as 'title', 200 as 'amount', 'silent';
select 'dbr.redirect', 'sp_DBR_entry_finished';

A HTTP GET call with return data stored in the record variable. Can be shown/handled in the template code.

select 'dbr.title', '';
select 'dbr.record', 'begin', 'get';
select 'dbr.http.post', 'http://seppo.local/slaakso/post_get.php?a=2',  1234 as 'businessline';

select 'dbr.record', 'end';
select 'dbr.template', '#get';

select 1 as 'dummy';