#set TITLE = lists
#include top

.SH Comma-delimited lists
A comma-delimited list (or "list" for short) is a list of items, delimited with commas
like this: \fCHarry,Ron,Hermione\fR
.LP
Lists are useful in storing sets or groups.  They can serve some of the same purposes
that arrays serve in other languages.  In databases, lists can conveniently provide a degree of
vectorization without requiring a separate table and joins.  
Lists can be a powerful approach-- the infamous programming language LISP made great use of lists.
.LP
There are a number of 
#set FILE = "functions.html#commalists"
#set TAG = "functions for working with lists."
#include link
.LP
Lists can be used...
.IP \(bu
as sets of items.. members can be added or removed from lists.
.IP \(bu
to control iteration (#for loops)

#if @QUISP = 1
.LP
In QUISP/SHSQL, lists can be used...
.IP \(bu
with \fC<select multiple>\fR CGI form fields.  The
#set FILE = "optionlist.html"
#set TAG = "#optionlist"
#include link
directive allows
<select multiple> boxes to be initialized directly by a list.
When a form is submitted <select multiple> responses can be converted to a list in the 
#set FILE = "cgiforms.html"
#set TAG = "form target page"
#include link
using the
#set FILE = "cgivar.html"
#set TAG = "#cgilistvar"
#include link
directive.
.IP \(bu
in WHERE clauses along with the IN, INLIKE, and INRANGE comparison operators;
SHSQL provides full index support for IN, INLIKE, and INRANGE
.IP \(bu
in databases to provide a limited degree of vectorization, a list of keywords associated with publications for instance.
As long as a JOIN on the list field is never required, this approach can simplify front-end code.
SHSQL allows such list fields to be indexed using a WORD index, and retrieved using CONTAINS in the
WHERE clause, for full index support.  
#endif

.LP
Since the total length of a comma-delimited list is limited to about 250 characters,
lists are most suitable where individual values are known to be small in size 
(such as controlled-vocabulary tags or integer id numbers) and where it is known that 
there will not be a huge number of choices. 
List members can not contain embedded commas, and there is no provision for escaping a comma.
List members can contain embedded spaces in some situations.



#include bottom
