list_colnam
Gets/sets the name of a column in a list.
Available in:
Apps (win) |
Apps (char) |
Reportwriter |
RPC |
Standalone PL |
X |
X |
X |
X |
X |
Syntax
string list_colnam(list-name,col-index[,col-name])
list list-name
expr col-index
string col-name
Description
Returns the name of a column specified by index.
If the specified list does not contain column names,
list_colnam() returns a NULL. If col-name
is specified, this function names the column and returns the
new name.
list-name | specifies the list to search.
|
col-index | specifies the column to name.
Lists created with a SELECT statement have column names associated
with them.
|
col-name | (optional) specifies a name for the column.
If the column has a name, it is replaced.
|
Example
Prints the name of the specified column in a given list.
{
list xx, yy;
xx = list_open("SELECT * FROM org", 1000);
yy = list_open("20 16 10", 1000, "LMD");
printf(list_colnam(xx, 0));
printf(list_colnam(xx, 1));
if (list_colnam(yy, 1) == NULL)
printf("No name exists");
else printf(list_colnam(yy,1));
list_close(xx);
list_close(yy);
}