Difference between revisions of "QueryBuilder"
Barrymavin (Talk | contribs) (Created page with "''Under construction''") |
Yvonne.milne (Talk | contribs) |
||
(13 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | '' | + | {{DISPLAYTITLE:Using the Query Builder}} |
+ | ==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"). | ||
+ | |||
+ | 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== | ||
+ | |||
+ | [[File:querybuilder1.png|middle|768px|link={{filepath:querybuilder1.png}}]] | ||
+ | |||
+ | Now let's see that in action. | ||
+ | |||
+ | [[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== | ||
+ | |||
+ | [[File: querybuilder31.png|middle|768px|link={{filepath: querybuilder31.png}}]] | ||
+ | |||
+ | Now let's see that in action. | ||
+ | |||
+ | [[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== | ||
+ | |||
+ | lib:/querybuilder.rsp?parameter=value¶meter=value... | ||
+ | |||
+ | {| class="wikitable" width="100%" | ||
+ | ! Parameter | ||
+ | ! Description | ||
+ | ! width="30%" | Default value | ||
+ | |- | ||
+ | | database | ||
+ | | | ||
+ | | | ||
+ | |- | ||
+ | | table | ||
+ | | | ||
+ | | | ||
+ | |- | ||
+ | |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 | ||
+ | | | ||
+ | |- | ||
+ | | 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 | ||
+ | |- | ||
+ | |valign="top"| 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== | ||
+ | |||
+ | <code lang="javascript"> | ||
+ | var sectionid = "page1.section1"; // or "myCallBackHandler()" | ||
+ | var database = "southwind"; | ||
+ | var table = "order_details"; | ||
+ | var columns = ""; | ||
+ | var filter = ""; | ||
+ | Lianja.showQueryBuilderPanel(sectionid, database, table, columns, filter); | ||
+ | </code> | ||
+ | |||
+ | [[File: querybuilder10.png|middle|768px|link={{filepath: querybuilder10.png}}]] | ||
+ | |||
+ | ==Popup a Query Builder Dialog== | ||
+ | |||
+ | <code lang="javascript"> | ||
+ | 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); | ||
+ | </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
Contents
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
Now let's see that in action.
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
Now let's see that in action.
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¶meter=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);
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);