Difference between revisions of "QueryBuilder"

From Lianjapedia
Jump to: navigation, search
(Slide in a Query Builder Dialog Panel)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{DISPLAYTITLE:Using the Query Builder}}
 
{{DISPLAYTITLE:Using the Query Builder}}
''Under construction''
 
 
 
==Overview==
 
==Overview==
 
To keep coding (NoCode) to a minimum there are many built-in [[Using WebViewWidgets|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").
 
To keep coding (NoCode) to a minimum there are many built-in [[Using WebViewWidgets|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").
Line 18: Line 16:
  
 
[[File: querybuilder2.png|middle|768px|link={{filepath: querybuilder2.png}}]]
 
[[File: querybuilder2.png|middle|768px|link={{filepath: querybuilder2.png}}]]
 +
 +
<div style="height:100px;margin-bottom:5px;padding:5px;border:0px solid orange;border-left:5px solid orange;background:#fff8dc;vertical-align:middle;position:relative;">
 +
[[File:bm-noteicon.png|top|40px|link=]]<div style="position:absolute;top:3px;margin-bottom;bottom:5px;margin-left:50px;"><b> Columns</b>
 +
From v9.1, you can define the Columns that appear in the Query Builder for this page.<br/>
 +
Specify a comma-separated list of column names in the [[Page_Attributes#Header|Header]] -> Columns attribute.<br>
 +
</div>
 +
<span style="height:6px;"> </span>
 +
</div>
  
 
==Using the Query Builder in Sections==
 
==Using the Query Builder in Sections==
Line 26: Line 32:
  
 
[[File: querybuilder4.png|middle|768px|link={{filepath: querybuilder4.png}}]]
 
[[File: querybuilder4.png|middle|768px|link={{filepath: querybuilder4.png}}]]
 +
 +
<div style="height:100px;margin-bottom:5px;padding:5px;border:0px solid orange;border-left:5px solid orange;background:#fff8dc;vertical-align:middle;position:relative;">
 +
[[File:bm-noteicon.png|top|40px|link=]]<div style="position:absolute;top:3px;margin-bottom;bottom:5px;margin-left:50px;"><b> Columns</b>
 +
From v9.1, you can define the Columns that appear in the Query Builder for this section.<br/>
 +
Specify a comma-separated list of column names in the Header -> Columns [[:Category:Attributes#Section_Attributes|attribute]].<br>
 +
</div>
 +
<span style="height:6px;"> </span>
 +
</div>
  
 
==Query Builder Parameters==
 
==Query Builder Parameters==
Line 44: Line 58:
 
|
 
|
 
|-
 
|-
| sectionid
+
|valign="top"| 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  
 
| 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  
 
|  
 
|  
Line 81: Line 95:
  
 
<code lang="javascript">
 
<code lang="javascript">
function myQueryPickerCallback(key, value)
+
var sectionid = "page1.section1";   // or "myCallBackHandler()"
{
+
    messageBox("You chose '"+value+"'");
+
}
+
 
+
var title = "Browse Orders";
+
var onselect = "myQueryPickerCallback()";
+
 
var database = "southwind";
 
var database = "southwind";
 
var table = "order_details";
 
var table = "order_details";
var params = "";   // e.g. parameter=value&parameter2=value...
+
var columns = "";  
var width = 900;
+
var filter = "";
Lianja.showQueryBuilder(title, onselect, database, table, params, width);
+
var modal = false;
 
+
var minbuttons = false;
 +
Lianja.showQueryBuilder(sectionid, database, table, columns, filter, modal, minbuttons);
 
</code>
 
</code>
 +
 +
[[File: querybuilder11.png|middle|768px|link={{filepath: querybuilder11.png}}]]
 +
 +
[[Category:Lianja v4.2]]
 +
[[Category:Lianja v9.1]]

Latest revision as of 08:56, 13 June 2023

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