RemoveItem (Stringlist function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
No edit summary
 
m (1 revision)
(No difference)

Revision as of 14:54, 24 November 2010

Remove item from Stringlist

RemoveItem is a member of the Stringlist class.

This callable method removes an item from a Stringlist, decrementing the item numbers of all items which follow. If removal of an item makes a CCATEMP Stringlist page empty, that page is removed from use by the Stringlist. Otherwise, space taken up by a removed item is made available on the Stringlist page for other items in the same Stringlist.

RemoveItem Syntax

[%rc =] %sl:RemoveItem(itemnum)

Syntax Terms

%rc
A numeric variable to contain the number of items remaining in the Stringlist after the item has been removed.
%sl
A Stringlist object.
itemnum
A number that specifies the item number in the Stringlist.

Usage Notes

  • All errors in RemoveItem result in request cancellation.
  • Consecutive Stringlist leaf pages that are made relatively empty with RemoveItem will not be merged together. Because of this, heavy use of Insert and RemoveItem can result in "sparse" Stringlists which place an unnecessary burden on the buffer pool and CCATEMP.
  • Heavy use of Insert and RemoveItem can result in an inability to add an item to the end of the Stringlist (via the Add method) because of a full pointer page, even though the Stringlist is nowhere near the theoretical capacity for a Stringlist. To make matters worse, Copy does a page-for-page copy of a Stringlist, so it does not result in any compression of the resultant Stringlist. Stringlist compression can be achieved using the CopyItems (Stringlist function).