$List Copy Items: Difference between revisions
m (1 revision) |
(Automatically generated page update) |
||
(37 intermediate revisions by 3 users not shown) | |||
Line 2: | Line 2: | ||
<span class="pageSubtitle">Copy items between $lists</span> | <span class="pageSubtitle">Copy items between $lists</span> | ||
<p class=" | <p class="warn"><b>Note: </b>Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $List_Copy_Items function is <var>[[CopyItems (Stringlist function)|CopyItems]]</var>.</p> | ||
This function copies items from one $list to another. Both the input and output $lists can be created by any of the $list creating functions. The copied items are appended to the end of the output $list. | This function copies items from one $list to another. Both the input and output $lists can be created by any of the $list creating functions. The copied items are appended to the end of the output $list. | ||
The <var>$List_Copy_Items</var> function accepts four arguments and returns a numeric result. It is a | The <var>$List_Copy_Items</var> function accepts four arguments and returns a numeric result. It is a [[Calling Sirius Mods $functions|callable]] $function. | ||
The first argument is the identifier of the output $list. This is a required argument. | The first argument is the identifier of the output $list. This is a required argument. | ||
Line 17: | Line 17: | ||
==Syntax== | ==Syntax== | ||
<p class="syntax" | <p class="syntax">[%RESULT =] $List_Copy_Items(list_id_output, list_id_input, - | ||
start_item, num_items) | start_item, num_items) | ||
</p> | </p> | ||
<p class=" | <p> | ||
</p> | |||
<p><var class="term">%result</var> is set either to the number of items in the output $list after the function is completed, or to a negative error code.</p> | |||
<p class="code"> | <p class="code"> | ||
Line 34: | Line 34: | ||
</p> | </p> | ||
<var>$List_Copy_Items</var> does an item for item copy so can be used to compress a $list that has become sparse as the result of heavy [[$ListIns]], [[$ListRep]], [[$ListAdj]] and/or [[$ListRem]] activity. $ListRep and [[$ListAdj]] will only cause a $list to become sparse if $list items are replaced with larger $list items or increased in size. The following chunk of code shows how $list %LIST can be compressed: | <var>$List_Copy_Items</var> does an item for item copy so can be used to compress a $list that has become sparse as the result of heavy [[$ListIns]], [[$ListRep]], [[$ListAdj]] and/or [[$ListRem]] activity. <var>$ListRep</var> and [[$ListAdj]] will only cause a $list to become sparse if $list items are replaced with larger $list items or increased in size. The following chunk of code shows how $list %LIST can be compressed: | ||
<p class="code"> %CLIST = $ListNew | <p class="code"> %CLIST = $ListNew | ||
Line 43: | Line 43: | ||
If copying an entire $list and no compression is required, [[$ListCpy]] is more efficient than <var>$List_Copy_Items</var> because the former does a page for page copy while the latter does an item for item copy.<p> | If copying an entire $list and no compression is required, [[$ListCpy]] is more efficient than <var>$List_Copy_Items</var> because the former does a page for page copy while the latter does an item for item copy.<p> | ||
==Products authorizing {{PAGENAMEE}}== | |||
<ul class="smallAndTightList"> | <ul class="smallAndTightList"> | ||
<li>[[Sirius functions]]</li> | <li>[[List of $functions|Sirius functions]]</li> | ||
<li>[[Fast/Unload User Language Interface]]</li> | <li>[[Fast/Unload User Language Interface]]</li> | ||
<li>[[Janus Open Client]]</li> | <li>[[Media:JoclrNew.pdf|Janus Open Client]]</li> | ||
<li>[[Janus Open Server]]</li> | <li>[[Media:JosrvrNew.pdf|Janus Open Server]]</li> | ||
<li>[[Janus Sockets]]</li> | <li>[[Janus Sockets]]</li> | ||
<li>[[Janus Web Server]]</li> | <li>[[Janus Web Server]]</li> | ||
<li> | <li>Japanese functions</li> | ||
<li>[[Sir2000 Field Migration Facility]]</li> | <li>[[Media:SirfieldNew.pdf|Sir2000 Field Migration Facility]]</li> | ||
</ul> | </ul> | ||
[[Category:$Functions|$List_Copy_Items]] | [[Category:$Functions|$List_Copy_Items]] |
Latest revision as of 22:51, 20 September 2018
Copy items between $lists
Note: Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $List_Copy_Items function is CopyItems.
This function copies items from one $list to another. Both the input and output $lists can be created by any of the $list creating functions. The copied items are appended to the end of the output $list.
The $List_Copy_Items function accepts four arguments and returns a numeric result. It is a callable $function.
The first argument is the identifier of the output $list. This is a required argument.
The second argument is the identifier of the input $list. This is a required argument.
The third argument is a number that is the starting item number in the input $list from which items are to be copied. This is an optional argument and defaults to the first item in the input $list if not specified.
The fourth argument is a number that is the number of items from the input $list that are to be copied. This is an optional argument and defaults to the number of items in the input $list after and including the starting item number. If set to a number greater than the number of items after and including the starting item number, all items after and including the starting item number are copied. A zero value for this argument is treated the same as if it were not specified.
Syntax
[%RESULT =] $List_Copy_Items(list_id_output, list_id_input, - start_item, num_items)
%result is set either to the number of items in the output $list after the function is completed, or to a negative error code.
-3 - No room in CCATEMP -5 - Required argument not specified -6 - $List identifier invalid -7 - Invalid starting item number -8 - Invalid item count
$List_Copy_Items does an item for item copy so can be used to compress a $list that has become sparse as the result of heavy $ListIns, $ListRep, $ListAdj and/or $ListRem activity. $ListRep and $ListAdj will only cause a $list to become sparse if $list items are replaced with larger $list items or increased in size. The following chunk of code shows how $list %LIST can be compressed:
%CLIST = $ListNew %RC = $List_Copy_Items(%CLIST, %LIST) %RC = $ListMove(%LIST, %CLIST)
If copying an entire $list and no compression is required, $ListCpy is more efficient than $List_Copy_Items because the former does a page for page copy while the latter does an item for item copy.