Difference between revisions of "BROWSE"

From Lianjapedia
Jump to: navigation, search
(Description)
 
(29 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Under construction: this documentation may refer to unsupported clauses and keywords
 
 
 
==Purpose==
 
==Purpose==
 
Data grid
 
Data grid
Line 7: Line 5:
 
BROWSE
 
BROWSE
  
[CAPTION <expC>]
+
[TABLE <tablename>]  
 
+
[COLOR <color code> | COLOR SCHEME <color-scheme>]
+
 
+
[COMPRESS]
+
  
 
[FIELDS <field list>]
 
[FIELDS <field list>]
Line 17: Line 11:
 
[FOR <expL1>]
 
[FOR <expL1>]
  
[FREEZE <fieldname>]
+
[NOACTIONBAR]
 
+
[KEY <key expression>]
+
 
+
[LAST | NOINIT]
+
 
+
[LOCK <expN1>]
+
  
 
[NOAPPEND]
 
[NOAPPEND]
 
[NOCLEAR]
 
  
 
[NODELETE]
 
[NODELETE]
  
 
[NOEDIT | NOMODIFY]
 
[NOEDIT | NOMODIFY]
 
[NOFOLLOW]
 
 
[NOMENU]
 
 
[NOWAIT]
 
 
[OVERLAY]
 
 
[SPLITBAR]
 
  
 
[STYLE <expC1>]
 
[STYLE <expC1>]
 
[TIMEOUT <expN2>]
 
  
 
[TITLE <expC2>]
 
[TITLE <expC2>]
  
[VALID [:F] <expL2> [ERROR <expC3>]]
+
[CAPTION <expC2>]
  
[WHEN <expL3>]
+
[KEY <expr>]
  
[WIDTH<expN3>]
+
[SPLITBAR]
  
[WINDOW <window name>]
+
[PROPERTIES "name=value;name2=value;etc"]
  
 
==See Also==
 
==See Also==
[[EDIT]], [[SQL_SELECT|SELECT]]
+
[[SQL_SELECT|SELECT]], [[SELECT]], [[SELECT()]], [[SET DELETED]], [[USE]]
  
 
==Description==
 
==Description==
The BROWSE user-interface tool displays the records from the currently active table in a grid window.
+
The BROWSE user-interface tool displays the records from the currently active table or (since 7.0) the TABLE specified in a grid window.
  
{| class="wikitable"
+
{| class="wikitable" width="100%"
!Keyword||Description
+
!width="35%"|Keyword||Description
|-
+
|COLOR <color code> &#124; COLOR SCHEME <color-scheme>||Specifies a set of color pairs or the number of an existing color scheme in the COLOR SCHEME to change the default color of BROWSE.  A color scheme is a set of 10 predefined color pairs.  The color pairs in a color scheme can be changed with the SET COLOR OF SCHEME.  A color pair is a set of two letters separated by a forward slash.  The first color letter specifies the foreground color and the second letter specifies the background color.
+
|-
+
|COMPRESS||Places column headings on the top line of the BROWSE work surface, with no separating line above the records, to allow more records to be displayed.
+
 
|-
 
|-
|FIELDS <field list>||The comma-separated <field list> enables you to: specify the order in which the specified fields display and incorporate special handling options for each field.  Please see below for these options.
+
|valign="top"|FIELDS <field list>||The comma-separated <field list> enables you to: specify the order in which the specified fields display and incorporate special handling options for each field.  Please see below for these options.
 
|-
 
|-
 
|}
 
|}
  
<field> [:R] [:column width]
+
<field> [:R]
 
+
[:B = <expr>, <expr> [:F]]
+
  
 
[:C = <expC> | <@alias>,<expC>]
 
[:C = <expC> | <@alias>,<expC>]
  
 
[:V = <expL> [F:] [:E = <expC>]
 
[:V = <expL> [F:] [:E = <expC>]
 
[:P = <expC>]
 
  
 
[:H = <expC>]
 
[:H = <expC>]
  
[:W = <expL>]
+
[:P = <expC>]
  
 
Each field in the <field list> may be followed by special handling options.  A delimiter precedes each option, either : or .
 
Each field in the <field list> may be followed by special handling options.  A delimiter precedes each option, either : or .
  
{| class="wikitable"
+
{| class="wikitable" width="100%"
!Option||Description
+
!width="35%"|Option||Description
 
|-
 
|-
|:R||Fields are read-only, so may be viewed, but not edited.
+
|valign="top"|:R||Fields are read-only, so may be viewed, but not edited.
 
|-
 
|-
|:<column width>||The <column width> allows you to specify the numeric display width of a field.
+
|valign="top"|:C = <expC> | <@alias>,<expC>||The Choicelist option associates a pulldown choicelist with a field.  The choicelist may be either 'static': a string of comma-separated choices or 'dynamic': @alias,string or a SQL Select query.
 
|-
 
|-
|:B = <expr>,<expr> [:F]||Restricts valid data input to a range of values.  The expressions specified must match the data type of the field and represent low <expr1> and high <expr1> values.  The specified range is only enforced when the field value changes unless the :F option is used.
+
|valign="top"|:V = <expL> [:E = <expC>] [:F]||Validates the field value based on the evaluation of <expL>.  If <expL> returns true (.T.), the field value is considered valid.  If <expL> returns false (.F.), the value is rejected and an error message displayed.  If the :E option is specified, <expC> replaces the default error message.  The validation is only enforced when the field value changes unless the :F option is used.
|-
+
|:C = <expC> | <@alias>,<expC>||The Choicelist option associates a pop-up choicelist or a User Defined Function (UDF) with a field.  The choicelist may be either 'static', a string of comma-separated choices, 'dynamic', @alias,string or a UDF, a function name prefixed with a question mark.
+
|-
+
|:V = <expL> [:E = <expC>] [:F]||Validates the field value based on the evaluation of <expL>.  If <expL> returns true (.T.), the field value is considered valid.  If <expL> returns false (.F.), the value is rejected and an error message displayed.  If the :E option is specified, <expC> replaces the default error message.  The validation is only enforced when the field value changes unless the :F option is used.
+
 
This option does not work on memo fields.
 
This option does not work on memo fields.
 
|-
 
|-
|:H = <expC>||Replaces the default field headings, field name or description, with the character expression <expC>.
+
|valign="top"|:H = <expC>||Replaces the default field headings, field name or description, with the character expression <expC>.
|-
+
|:M = <expC>||Displays <expC> in the message line when the field is selected.
+
|-
+
|:P = <expC>||Sets the picture format to <expC>.  For more information on picture template characters and picture formatting, see @...GET.
+
 
|-
 
|-
|:W = <expL>||Only allows data entry when <expL> evaluates to true (.T.), otherwise the field is read-only.
+
|valign="top"|:P = <expC>||Sets the picture format to <expC>. For more information on picture template characters and picture formatting, see @...GET.
 
|-
 
|-
 
|}
 
|}
  
The <field list> can also include memory variables calculated by specified expressions.  These take the format <memvar> = <expression>.  The memory variables may not be manually updated in the BROWSE.
 
  
{| class="wikitable"
+
{| class="wikitable" width="100%"
!Keyword||Description
+
!width="35%"|Keyword||Description
 
|-
 
|-
|FOR <condition>||Restricts the BROWSE to those records matching the <condition>.
+
|valign="top"|TABLE <tablename>||Opens the specified table if its not yet open. This may be databasename!tablename.
 
|-
 
|-
|FREEZE <fieldname>||Restricts cursor movement to the column containing the field <fieldname>.
+
|valign="top"|FOR <condition>||Restricts the BROWSE to those records matching the <condition>.
 
|-
 
|-
|KEY <key expression>||Restricts the BROWSE to those records whose index key matches the specified <key expression>.
+
|valign="top"|NOACTIONBAR||Hides the actionbar at the bottom of the grid.
 
|-
 
|-
|LAST | NOINIT||Causes BROWSE to inherit the settings and clauses from the previous BROWSE.
+
|valign="top"|NOAPPEND||Disables the appending of new records into the table.
 
|-
 
|-
|LOCK <expN1>||Locks the specified number of columns <expN1> from the left.  As you pan right and left, the locked columns remain on the screen and the columns to the right are panned.
+
|valign="top"|NODELETE||valign=top|Disables record deletion.
 
|-
 
|-
|NOAPPEND||Disables the appending of new records into the table.
+
|valign="top"|NOEDIT | NOMODIFY||Disables record editing, providing read-only access to the table.
 
|-
 
|-
|NOCLEAR||Leaves the BROWSE window displayed on the screen when you exit.
+
|valign="top"|STYLE <expC1>||Specify the CSS style, <expC1>, to be used.
 
|-
 
|-
|NODELETE||Disables record deletion.
+
|valign="top"|TITLE <expC2>||Specify a title, <expC2> to be displayed.
 
|-
 
|-
|NOEDIT | NOMODIFY||Disables record editing, providing read-only access to the table.
+
|valign="top"|CAPTION <expC3>||valign=top|The selection caption to be displayed. Use this for picklists
 
|-
 
|-
|NOFOLLOW||Prevents repositioning in the worksurface when an index key field value is edited.
+
|valign="top"|SPLITBAR||valign=top|Enable split screen editing.
 
|-
 
|-
|NOMENU||The NOMENU clause disables the BROWSE menu system.
+
|valign="top"|KEY <expr>||valign=top|position (seek) to the specified key in the grid.
 
|-
 
|-
|NOWAIT||Continues program execution immediately after the BROWSE command has been issued, rather than when the BROWSE is exited.  The BROWSE is displayed, but not active.
+
|valign="top"|PROPERTIES <expr>||valign=top|Apply the specified properties to the grid e.g PROPERTIES "showsplitedit=true;splitmemolist=notes:caption;splitmemoeditors=html;splitimagelist=photo:caption". <br>The :caption is optional but can be used to provide a more meaningful Tab caption.
|-
+
|OVERLAY||Allows format files to be overlaid on the BROWSE worksurface rather than clearing the screen.
+
|-
+
|STYLE <expC1>||Specify the font style, <expC1>, to be used.
+
|-
+
|TIMEOUT <expN2>||Specify how many seconds, <expN2>, BROWSE should wait for input before closing automatically.
+
|-
+
|TITLE <expC2>||Specify a title, <expC2> to be displayed.
+
|-
+
|VALID [:F] <expL2> [ERROR <expC3>]||Allows record-level validation in a Browse window.  VALID is executed only if a change is made to the record and an attempt is made to move the cursor to another record. The VALID clause is not executed if the only change is to a memo field.  If <expL2> evaluates to true (.T.), the cursor can be moved to another record. If <expL2> evaluates to false (.F.), the cursor remains in the current field, and the system message "Invalid input" appears.  An alternative error message can be specified, using the optional ERROR clause and the character expression <expC3> will be displayed.  To force the VALID clause to execute before moving to another record even if no changes have been made, include the optional :F.
+
|-
+
|WHEN <expL3>||FoxPro syntax compatibility only.
+
|-
+
|WIDTH||Specifies a display size for all fields.  This option will override the width specified at the field level.
+
|-
+
|WINDOW <window name>||Causes the BROWSE output window to take on the characteristics of the named <window name> pre-defined window.  The specified window need not be visible or active.
+
 
|-
 
|-
 
|}
 
|}
Line 165: Line 106:
 
open database southwind
 
open database southwind
 
use example
 
use example
browse field title:c="MR.Mrs,Miss,Mr",;
+
browse fields title:c="Mr,Mrs,Ms",;
  last_name:w=10,;
+
last_name:r,;
  first_name
+
first_name
 +
 
 +
// Style keyword
 +
open database southwind
 +
use example
 +
browse noactionbar ;
 +
style "* { selection-color:yellow; ;
 +
selection-background-color:black; ;
 +
gridline-color:green; ;
 +
background:black;color:yellow; ;
 +
} ;
 +
QTableView::item { background:lightgreen; } ;
 +
QHeaderView::section { background-color:green;color:white;border:0px; } "
 
</code>
 
</code>
 +
 +
==Browse Splitbar==
 +
The '''splitbar''' keyword displays a split grid.  The '''properties''' specify the memo/varchar and or image/blob column(s) to be displayed, here the employees memo column 'notes' and image column 'photo':
 +
 +
<pre>splitmemolist=notes;splitimagelist=photo</pre>
 +
 +
The memo editor type can also be specified: 'html' or 'text':
 +
 +
<pre>splitmemoeditors=html</pre>
 +
 +
[[{{ns:file}}:browseSplitbar.png|800px|left|border|link={{filepath:browseSplitbar.png}}|Browse Splitbar]]
 +
<br clear=all>
 +
 +
See also: [[Split Grid Sections]]
 +
 +
==Query Builder==
 +
From Lianja v6.3, the [[QueryBuilder]] is supported in BROWSE.  Just click the icon in the actionbar to open the [[QueryBuilder]].
 +
 +
[[{{ns:file}}:browse_querybuilder.png|800px|left|border|link={{filepath:browse_querybuilder.png}}|Browse: Query Builder]]
 +
<br clear=all>
 +
 +
==Search Bar==
 +
From Lianja v6.3, a Search Bar is supported in BROWSE.  This searches across all columns.  Type a value, then press Return to search.  Pressing the down arrow will focus onto the grid.  Once you choose a record you can press Return/Enter to select it. The _result variable will contain the record number of the selected record and it will be active in the cursor that you are browsing.
 +
 +
This low-code functionality can be used effectively for picklists from dialog button delegates or custom query delegates.
 +
 +
[[{{ns:file}}:browse_searchbar.png|800px|left|border|link={{filepath:browse_searchbar.png}}|Browse: Search Bar]]
 +
<br clear=all>
 +
 +
The same [[Grid_Appearance#Search_bar_visible|Search Bar]] functionality is also available in [[Grid Section Attributes|Grid Sections]] and the [[:Category:Data_Workspace|Data Editor in the Data Workspace]] from v6.3.
  
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Commands]]
 
[[Category:Commands]]
[[Category:Screen Forms]]
+
[[Category:NoSQL Commands]]
[[Category:Screen Forms Commands]]
+
[[Category:Lianja v6.3]]

Latest revision as of 23:54, 23 March 2024

Purpose

Data grid

Syntax

BROWSE

[TABLE <tablename>]

[FIELDS <field list>]

[FOR <expL1>]

[NOACTIONBAR]

[NOAPPEND]

[NODELETE]

[NOEDIT | NOMODIFY]

[STYLE <expC1>]

[TITLE <expC2>]

[CAPTION <expC2>]

[KEY <expr>]

[SPLITBAR]

[PROPERTIES "name=value;name2=value;etc"]

See Also

SELECT, SELECT, SELECT(), SET DELETED, USE

Description

The BROWSE user-interface tool displays the records from the currently active table or (since 7.0) the TABLE specified in a grid window.

Keyword Description
FIELDS <field list> The comma-separated <field list> enables you to: specify the order in which the specified fields display and incorporate special handling options for each field. Please see below for these options.

<field> [:R]

[:C = <expC> | <@alias>,<expC>]

[:V = <expL> [F:] [:E = <expC>]

[:H = <expC>]

[:P = <expC>]

Each field in the <field list> may be followed by special handling options. A delimiter precedes each option, either : or .

Option Description
:R Fields are read-only, so may be viewed, but not edited.
:C = <expC> | <@alias>,<expC> The Choicelist option associates a pulldown choicelist with a field. The choicelist may be either 'static': a string of comma-separated choices or 'dynamic': @alias,string or a SQL Select query.
:V = <expL> [:E = <expC>] [:F] Validates the field value based on the evaluation of <expL>. If <expL> returns true (.T.), the field value is considered valid. If <expL> returns false (.F.), the value is rejected and an error message displayed. If the :E option is specified, <expC> replaces the default error message. The validation is only enforced when the field value changes unless the :F option is used.

This option does not work on memo fields.

:H = <expC> Replaces the default field headings, field name or description, with the character expression <expC>.
:P = <expC> Sets the picture format to <expC>. For more information on picture template characters and picture formatting, see @...GET.


Keyword Description
TABLE <tablename> Opens the specified table if its not yet open. This may be databasename!tablename.
FOR <condition> Restricts the BROWSE to those records matching the <condition>.
NOACTIONBAR Hides the actionbar at the bottom of the grid.
NOAPPEND Disables the appending of new records into the table.
NODELETE Disables record deletion.
NOEDIT | NOMODIFY Disables record editing, providing read-only access to the table.
STYLE <expC1> Specify the CSS style, <expC1>, to be used.
TITLE <expC2> Specify a title, <expC2> to be displayed.
CAPTION <expC3> The selection caption to be displayed. Use this for picklists
SPLITBAR Enable split screen editing.
KEY <expr> position (seek) to the specified key in the grid.
PROPERTIES <expr> Apply the specified properties to the grid e.g PROPERTIES "showsplitedit=true;splitmemolist=notes:caption;splitmemoeditors=html;splitimagelist=photo:caption".
The :caption is optional but can be used to provide a more meaningful Tab caption.

Example

open database southwind
use example
browse fields title:c="Mr,Mrs,Ms",;
	last_name:r,;
	first_name
 
// Style keyword
open database southwind
use example
browse noactionbar ;
	style "* { selection-color:yellow; ;
		selection-background-color:black; ;
		gridline-color:green; ;
		background:black;color:yellow; ;
		} ;
	QTableView::item { background:lightgreen; } ;
	QHeaderView::section { background-color:green;color:white;border:0px; } "

Browse Splitbar

The splitbar keyword displays a split grid. The properties specify the memo/varchar and or image/blob column(s) to be displayed, here the employees memo column 'notes' and image column 'photo':

splitmemolist=notes;splitimagelist=photo

The memo editor type can also be specified: 'html' or 'text':

splitmemoeditors=html
Browse Splitbar


See also: Split Grid Sections

Query Builder

From Lianja v6.3, the QueryBuilder is supported in BROWSE. Just click the icon in the actionbar to open the QueryBuilder.

Browse: Query Builder


Search Bar

From Lianja v6.3, a Search Bar is supported in BROWSE. This searches across all columns. Type a value, then press Return to search. Pressing the down arrow will focus onto the grid. Once you choose a record you can press Return/Enter to select it. The _result variable will contain the record number of the selected record and it will be active in the cursor that you are browsing.

This low-code functionality can be used effectively for picklists from dialog button delegates or custom query delegates.

Browse: Search Bar


The same Search Bar functionality is also available in Grid Sections and the Data Editor in the Data Workspace from v6.3.