list_copy2
Copies a list.
Available in:
Apps (win) |
Apps (char) |
Reportwriter |
RPC |
Standalone PL |
X |
X |
X |
X |
X |
Syntax
list list_copy2(src-list,cnt | fnc[,col,...])
list src-list
int cnt
trigger fnc
expr col
Description
Returns a modified copy of src-list.
src-list | specifies the list to copy.
|
cnt | specifies the rows to be copied.
-1 | all rows.
|
0 | no rows, only the list format.
|
n | n rows beginning at the current item.
|
|
fnc | a function that receives src-list
as parm.0 and returns true if the row is to be copied, false
if it is not to be copied.
If the function modifies the contents of the row, then the original row
in src-list is also modified.
|
col | a list of column numbers to be copied.
Column numbers can be any expression that evaluates to either an integer or
a char string containing space-delimited
integers or any combination of these.
Columns
may be re-ordered or duplicated however the new list cannot have more columns
than the original list.
|
Notes
Any indexes on src-list will not be carried over to the new list.
Example
Copies columns 1 and 0 from all records where data in column
1 begins with either 'S' or 'M".
{
char re[80] = "^[SM]";
list LL,NL;
trigger want = { list_modcol(parm.0,0,1000*list_curr(parm.0,0));
return(regexp(regexp_exist,list_curr(parm.0,1)));
};
regexp(regexp_init,re);
LL = list_open("select * from staff",99,"Regular expression: " ^^ re);
NL = list_copy2(LL,want,1,0);
list_view(NL,0);
}