MoveToId (Stringlist subroutine): Difference between revisions
Jump to navigation
Jump to search
m (more consistent layout and better tagging) |
m (→Examples) |
||
Line 21: | Line 21: | ||
==Examples== | ==Examples== | ||
Suppose complex subroutine Summarize takes a $list identifier as its input parameter. Now, suppose some code that has a <var>Stringlist</var> in %list wants to pass the <var>Stringlist</var> to Summarize. | |||
The following code illustrates how this can be accomplished: | The following code illustrates how this can be accomplished: | ||
Line 29: | Line 29: | ||
%list:moveFromId(%listId) | %list:moveFromId(%listId) | ||
return | return | ||
</p | </p> | ||
==See also== | ==See also== | ||
<ul><li><var>[[MoveFromId (Stringlist subroutine)|MoveFromId]]</var> which does the converse (move <var>$list</var> data into a <var>Stringlist</var>)</ul> | <ul><li><var>[[MoveFromId (Stringlist subroutine)|MoveFromId]]</var> which does the converse (move <var>$list</var> data into a <var>Stringlist</var>)</ul> | ||
{{Template:Stringlist:MoveToId footer}} | {{Template:Stringlist:MoveToId footer}} |
Revision as of 23:09, 2 May 2012
Move data from Stringlist to $list (Stringlist class)
This method moves data (stringlist items) from a stringlist to a $list. MoveToId is a subroutine that accepts one argument: the $list identifier of the $list to which data is to be moved. For more information about $list identifiers, see the Sirius Functions Reference Manual.
Syntax
sl:MoveToId( listId)
Syntax terms
sl | A Stringlist object. |
---|---|
listId | The $list identifier of the $list to which data is to be moved. |
Usage notes
- All errors in MoveToId result in request cancellation.
- After MoveToId is invoked, the method Stringlist is emptied, although the object variable is still valid (non-null).
- MoveToId discards any current contents of the target $list.
- MoveToId copies to the target $list any image association that is set via BindImage.
- MoveToId simply moves the Stringlist internal data pointers to the to the target $list. It does not actually perform any data movement; therefore, it is extremely efficient.
- MoveToId is intended to facilitate the migration to the use of Stringlists of existing applications that use $lists.
- stringlists should always be used in preference to $lists, so MoveToId is provided only for the migration of existing $list applications to the use of stringlists.
Examples
Suppose complex subroutine Summarize takes a $list identifier as its input parameter. Now, suppose some code that has a Stringlist in %list wants to pass the Stringlist to Summarize. The following code illustrates how this can be accomplished:
%listid = $listnew %list:moveToId(%listId) call summarize(%listId) %list:moveFromId(%listId) return
See also
- MoveFromId which does the converse (move $list data into a Stringlist)