Available in:
Apps (win)
Apps (char)
Reportwriter
RPC
Standalone PL
X
X
X
X
X
list list_open(spec,limit[,title[,...]]) expr spec int limit string title
| limit | specifies the maximum number of rows that can be loaded
into the new list. If spec is a SELECT, and this parameter
is -1, the function executes a SQL DESCRIBE with the resulting
list containing the column information.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| spec | can be a:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| title | specifies the title that appears at the top of the list box during list_view operations. |
ll = list_open("select_procedure-name [&parm1 &parm2 ...]",...)
For example, staff2 is a stored procedure defined as:
create procedure staff2 @p1 integer as SELECT * FROM staff WHERE id > @p1To return the first 20 rows where id > 42:
int id;
id = 42;
ll = list_open("select_staff2 &id",20);
xx = list_open("SELECT * FROM " ^^ tname,-1,tname);
Load a list from the database.
xx = list_open("SELECT * FROM emp",1000,"All employees");
Define a list.
xx = list_open("20 16 10",1000,"Beers of the world");
Load a list from a file.
xx = list_open("/etc/passwd",1000,"Users","(from passwd file)");
Load a binary list from a file.
xx = list_open("mylist",1000,"Sales information");
or
xx = list_open("B mylist",1000,"Sales information");
Load a previously stored shared list.
xx = list_open("s zipcode",1000,"Zip Codes of USA");
The following example loads a delimited file into a list. This example is an actual
working application that uses an FTP logfile, loads it into a
list where it is processed for database entry.
int i; list CL, LL, NL; datetime dt; char buf[80], host [160]; /* building the spec */ list_mod(CL, 1, ``xferlog''); list_mod(CL, 1, ``variable''); list_mod(CL, 1, `` ``); list_mod(CL, 1, `` ``); list_mod(CL, 1, ``C''); /* 0 -- day of week */ list_mod(CL, 1, ``C''); /* 1 -- month */ list_mod(CL, 1, ``C''); /* 2 -- day */ list_mod(CL, 1, ``C''); /* 3 -- time */ list_mod(CL, 1, ``C''); /* 4 -- year */ list_mod(CL, 1, ``N''); /* 5 -- transfer time */ list_mod(CL, 1, ``C''); /* 6 -- host */ list_mod(CL, 1, ``N''); /* 7 -- file size */ list_mod(CL, 1, ``C''); /* 8 -- file name */ list_mod(CL, 1, ``C''); /* 9 -- ascii/binary transfer */ list_mod(CL, 1, ``C''); /* 10 - special action */ list_mod(CL, 1, ``C''); /* 11 - direction */ list_mod(CL, 1, ``C''); /* 12 - access mode */ list_mod(CL, 1, ``C''); /* 13 - user name */ list_mod(CL, 1, ``C''); /* 14 - service name */ list_mod(CL, 1, ``C''); /* 15 - auth method */ list_mod(CL, 1, ``C''); /* 16 - auth ID */ /* opening the list using the spec */ LL = list_open(CL, 10000000); /* now process the list */