Using the Query Builder

From Lianjapedia
Jump to: navigation, search

Overview

To keep coding (NoCode) to a minimum there are many built-in WebViewWidgets that can be used with Lianja.showDialogPanel(), Lianja.showDialog() or as the URL in a WebView section or in a custom WebView object created with createObject("webview").

The Query Builder is a powerful WebViewWidget that can be integrated into your Apps to provide end-users with the ability to drill down through data without you having to write any custom code.

A picture says a thousand words so let's look at the Query Builder then see how we can use it in our Apps.

You will typically want to show the Query Builder when the "Search Icon" in pages and/or sections is clicked.

Using the Query Builder in Pages

Querybuilder1.png

Now let's see that in action.

Querybuilder2.png

Bm-noteicon.png
Columns

From v9.1, you can define the Columns that appear in the Query Builder for this page.
Specify a comma-separated list of column names in the Header -> Columns attribute.

Using the Query Builder in Sections

Querybuilder31.png

Now let's see that in action.

Querybuilder4.png

Bm-noteicon.png
Columns

From v9.1, you can define the Columns that appear in the Query Builder for this section.
Specify a comma-separated list of column names in the Header -> Columns attribute.

Query Builder Parameters

lib:/querybuilder.rsp?parameter=value&parameter=value...

Parameter Description Default value
database
table
sectionid If this is specified e.g. page1.section then the filter will be applied as a searchfilter to the page or section. If it is not specified you can specify an onselect delegate
columns A comma separated list of columns
filter An initial filter that can be edited
minbuttons If true only Cancel and Done buttons are shown false
onselect The optional delegate to be called when a query is applied. The delegate is called with one argument, the sql condition that has been built.

Slide in a Query Builder Dialog Panel

var sectionid = "page1.section1";    // or "myCallBackHandler()"
var database = "southwind";
var table = "order_details";
var columns = "";   
var filter = "";
Lianja.showQueryBuilderPanel(sectionid, database, table, columns, filter);

Querybuilder10.png

Popup a Query Builder Dialog

var sectionid = "page1.section1";    // or "myCallBackHandler()"
var database = "southwind";
var table = "order_details";
var columns = "";   
var filter = "";
var modal = false;
var minbuttons = false;
Lianja.showQueryBuilder(sectionid, database, table, columns, filter, modal, minbuttons);

Querybuilder11.png