Difference between revisions of "LIST"

From Lianjapedia
Jump to: navigation, search
m (1 revision)
(Description)
 
(15 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
''[[LIST Commands|LIST ... commands]]''
 +
 
==Purpose==
 
==Purpose==
 
List the contents of the active table and any related tables
 
List the contents of the active table and any related tables
 
  
 
==Syntax==
 
==Syntax==
LIST [<scope>]
+
LIST  
 +
 
 +
[IN <workarea>|<alias>]
 +
 
 +
[<scope>]
  
 
[FIELDS <field list>|<exp list>]
 
[FIELDS <field list>|<exp list>]
Line 11: Line 16:
  
 
[HEADING]
 
[HEADING]
 +
 +
[HTML [ONCLICK "<columnname>", "<javascriptfunction('{}')>"]]
  
 
[OFF]
 
[OFF]
  
[TO FILE <.txt filename> | (<expC>)] | [TO PRINT]
+
[TO FILE <.txt filename> | (<expC>)]  
  
 
[WHILE <condition>]
 
[WHILE <condition>]
 
  
 
==See Also==
 
==See Also==
[[CREATE REPORT]], [[DB_PRINT]], [[DIR]], [[DISPLAY]], [[Display and List]], [[DISPLAY MEMORY]], [[DISPLAY STATUS]], [[DISPLAY STRUCTURE]], [[Function Keys]], [[REPORT]], [[SCOPE]], [[SET DESCRIPTIONS]], [[SET FILTER]], [[SET HEADING]], [[SET PAGELENGTH]], [[SET PAGEWIDTH]], [[SET PRINTER]], [[SET RELATION]]
+
[[DIR]], [[DISPLAY]], [[Display and List]], [[DISPLAY MEMORY]], [[DISPLAY STATUS]], [[DISPLAY STRUCTURE]], [[SCOPE]], [[SET FILTER]] [[SET RELATION]]
 
+
  
 
==Description==
 
==Description==
The LIST command is a general purpose Recital/4GL query command that retrieves and displays the contents of table files on the screen.  The LIST command scrolls continuously unless halted by the [HOLD SCREEN] key, thereby differing from DISPLAY commands, which pause every 17 lines until a key is pressedWhen displaying a record that is longer than the screen width, the contents to the right of the display normally will not be displayed unless you have set your terminal to wrap.  Consult the relevant manual for your terminal regarding this feature.
+
The LIST command is a general purpose Lianja query command that retrieves and displays the contents of table files.  The expressions that you specify can be any valid Lianja expression, including the use of alias pointers into other workareasIf you have SET RELATION TO another table, for each record that is read from the active table, the related table will have its record pointer positioned, and the appropriate record read into its workarea.
  
LIST is more powerful than it looks initially.  The expressions that you specify can be any valid Recital expression, including the use of alias pointers into other workareas.  If you have SET RELATION TO another table, for each record that is read from the active table, the related table will have its record pointer positioned, and the appropriate record read into its workarea.
+
If SET FILTER TO <condition> is in effect, only those records that satisfy the filter <condition> will be displayed.
  
If SET FILTER TO <condition> is in effect, only those records that satisfy the filter <condition> will be displayed.  If SET DESCRIPTIONS and SET HEADING are both ON and the FIELDS clause is specified, the field descriptions will be used as the column headings rather than the field names.  The command SET HEADING TO SINGLE | DOUBLE | NONE controls the underlining of the column headings.
+
{| class="wikitable" width="100%"
 
+
!width="30%"|Keyword||Description
 
+
{| class="wikitable"
+
!Keyword||Description
+
 
|-
 
|-
|<scope>||If the [[SCOPE]] is not specified, all records will be displayed, unless the WHILE clause is used, in which case it will default to REST.
+
|valign="top"|IN <workarea>&#124;<alias>||If the workarea number, letter or alias name is specified, the LIST is carried out in that workarea.  Note, the IN clause must be the first clause.  From v6.0.
 
|-
 
|-
|FOR <condition>||Only those records that satisfy the <condition> are displayed.
+
|valign="top"|<scope>||If the [[SCOPE]] is not specified, all records will be displayed, unless the WHILE clause is used, in which case it will default to REST.
 
|-
 
|-
|OFF||Disables the display of the record number in the first column of the results.
+
|valign="top"|FOR <condition>||Only those records that satisfy the <condition> are displayed.
 
|-
 
|-
|FIELDS <list>||Restricts the fields displayed to those specified.
+
|valign="top"|OFF||Disables the display of the record number in the first column of the results.
 
|-
 
|-
|HEADING||A heading corresponding to either the field names or the expression will be displayed above each column even if SET HEADING is OFF.
+
|valign="top"|FIELDS <list>||Restricts the fields displayed to those specified.
 
|-
 
|-
|TO <file>||The display output will be sent to the specified file.  The filename can be substituted with a <expC>, enclosed in round brackets, which returns a valid filename.  If no file extension is specified, then ".txt" will be used.  The command SET PAGELENGTH governs the output file pagination and SET PAGEWIDTH defines the width of each page.  Page numbers are centered on the bottom of the page according to width.
+
|valign="top"|HEADING||A heading corresponding to either the field names or the expression will be displayed above each column even if SET HEADING is OFF.
 
|-
 
|-
|TO PRINT||The display output will be sent to a printer. The TO PRINT option will default to a local printer unless the command SET PRINTER TO \\SPOOLER is issued. The print request will then be spooled to the system printer, which is defined by the environment variable DB_PRINT.
+
|valign="top"|HTML||Used in .rsp pages, the HTML keyword causes the data to be output as an HTML table with bootstrap classes. These will be ignored if you have not included bootstrap in your .rsp file. The optional clause ONCLICK "columnname", "javascriptfunction('{}')" can also be specified to generate a hyperlink for "columnname" that calls the specified javascriptfunction when it is clicked. The {} is substituted with the value of the "columnname". This can be used to link across to other pages and search for data.
 
|-
 
|-
|WHILE <condition>||The [[SCOPE]] defaults to REST and records are displayed until the <condition> becomes false.
+
|valign="top"|TO <file>||The display output will be sent to the specified file.  The filename can be substituted with a <expC>, enclosed in round brackets, which returns a valid filename. 
 +
|-
 +
|valign="top"|WHILE <condition>||The [[SCOPE]] defaults to REST and records are displayed until the <condition> becomes false.
 
|-
 
|-
 
|}
 
|}
 
  
 
==Example==
 
==Example==
Line 61: Line 64:
 
</code>
 
</code>
  
==Products==
+
<code lang="recital">
Recital Server, Recital
+
// rsp example
 +
<%@ Language=VFP %>
 +
<html>
 +
<head>
 +
<%
 +
if not isServer()
 +
    ? "<link rel='stylesheet' href='lib:/bootstrap/css/bootstrap.min.css' type='text/css'/>"
 +
else
 +
    ? "<link rel='stylesheet' href='../../library/bootstrap/css/bootstrap.min.css' type='text/css'/>"
 +
endif
 +
%>
 +
<style type='text/css'>
 +
body {
 +
    margin:10px;
 +
}
 +
</style>
 +
</head>
 +
<body>
 +
<%
 +
text raw
 +
<script>
 +
function editCustomerID(customerid)
 +
{
 +
    Lianja.showDocument("page:page1?action=search&text="+customerid);
 +
};
 +
</script>
 +
endtext
 +
save datasession
 +
open database southwind
 +
use customers
 +
list html off ;
 +
    fields customerid,companyname,contacttitle,contactname,address,region,city,country ; 
 +
    onclick "customerid","editCustomerID('{}')"
 +
restore datasession
 +
%>
 +
</body>
 +
</html>
 +
</code>
 +
 
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Commands]]
 
[[Category:Commands]]
[[Category:Table Basics]]
+
[[Category:NoSQL Commands]]
[[Category:Table Basics Commands]]
+

Latest revision as of 08:06, 4 January 2021

LIST ... commands

Purpose

List the contents of the active table and any related tables

Syntax

LIST

[IN <workarea>|<alias>]

[<scope>]

[FIELDS <field list>|<exp list>]

[FOR <condition>]

[HEADING]

[HTML [ONCLICK "<columnname>", "<javascriptfunction('{}')>"]]

[OFF]

[TO FILE <.txt filename> | (<expC>)]

[WHILE <condition>]

See Also

DIR, DISPLAY, Display and List, DISPLAY MEMORY, DISPLAY STATUS, DISPLAY STRUCTURE, SCOPE, SET FILTER SET RELATION

Description

The LIST command is a general purpose Lianja query command that retrieves and displays the contents of table files. The expressions that you specify can be any valid Lianja expression, including the use of alias pointers into other workareas. If you have SET RELATION TO another table, for each record that is read from the active table, the related table will have its record pointer positioned, and the appropriate record read into its workarea.

If SET FILTER TO <condition> is in effect, only those records that satisfy the filter <condition> will be displayed.

Keyword Description
IN <workarea>|<alias> If the workarea number, letter or alias name is specified, the LIST is carried out in that workarea. Note, the IN clause must be the first clause. From v6.0.
<scope> If the SCOPE is not specified, all records will be displayed, unless the WHILE clause is used, in which case it will default to REST.
FOR <condition> Only those records that satisfy the <condition> are displayed.
OFF Disables the display of the record number in the first column of the results.
FIELDS <list> Restricts the fields displayed to those specified.
HEADING A heading corresponding to either the field names or the expression will be displayed above each column even if SET HEADING is OFF.
HTML Used in .rsp pages, the HTML keyword causes the data to be output as an HTML table with bootstrap classes. These will be ignored if you have not included bootstrap in your .rsp file. The optional clause ONCLICK "columnname", "javascriptfunction('{}')" can also be specified to generate a hyperlink for "columnname" that calls the specified javascriptfunction when it is clicked. The {} is substituted with the value of the "columnname". This can be used to link across to other pages and search for data.
TO <file> The display output will be sent to the specified file. The filename can be substituted with a <expC>, enclosed in round brackets, which returns a valid filename.
WHILE <condition> The SCOPE defaults to REST and records are displayed until the <condition> becomes false.

Example

open database southwind
use products order categoryid
seek 2
list productid, productname while categoryid = 2
// rsp example
<%@ Language=VFP %>
<html>
<head>
<%
if not isServer()
    ? "<link rel='stylesheet' href='lib:/bootstrap/css/bootstrap.min.css' type='text/css'/>"
else
    ? "<link rel='stylesheet' href='../../library/bootstrap/css/bootstrap.min.css' type='text/css'/>"
endif
%>
<style type='text/css'>
body {
    margin:10px;
}
</style>
</head>
<body>
<%
text raw
<script>
function editCustomerID(customerid)
{
    Lianja.showDocument("page:page1?action=search&text="+customerid);
};
</script>
endtext
save datasession
open database southwind
use customers
list html off ;
    fields customerid,companyname,contacttitle,contactname,address,region,city,country ;  
    onclick "customerid","editCustomerID('{}')"
restore datasession
%>
</body>
</html>