4DQuiz


Item Utility Routines View from small screen devices!  

Item Utility Routines

The following routines allow you to fold, spindle and otherwise manipulate individual items within an object.

OT CompareItems version 1

OT CompareItems(inSourceObject; inSourceTag; inCompareObject; inCompareTag) Number

Parameter Type Description

inSourceObject Longint A handle to an object

inSourceTag String An item tag

inCompareObject Longint A handle to an object

inCompareTag String An item tag

Function result Number 0 if not identical, 1 if identical, -1 if

an error occurred

Discussion

OT CompareItems compares two items for equality. inSourceObject and inCompareObject may be the same object.

If inSourceObject or inCompareObject is not a valid object handle, if either of the two items do not exist, or if the two items do not have the same type, an error is generated, OK is set to zero, and -1 is returned.

Otherwise, the items are compared according to the rules of equality used for equivalent variable types in 4D, with the addition that you may compare BLOB, Picture and embedded object items. These additional types are considered identical if they contain the same data byte for byte.

OT RenameItem version 2

OT RenameItem(inObject; inTag; inNewTag)

Parameter Type Description

inObject Longint A handle to an object

inTag String A full item tag

inNewTag String The new item tag

Discussion

OT RenameItem renames the item referenced by inTag to the item referenced by inNewTag. Note that inTag must be a full tag if the target item is in an embedded object, whereas inNewTag is the new item name only. For example:

OT RenameItem($obj;"foo.bar.old_name";"new_name")

The above example will rename the item old_name to new_name within the embedded object foo.bar. To access the renamed item you would use the tag "foo.bar.new_name".

If the object handle is invalid, or if the item does not exist, or if an existing item has the same name as inNewTag, an error is generated, OK is set to zero, and no rename is performed.

OT CopyItem version 1

OT CopyItem(inSourceObject; inSourceTag; inDestObject; inDestTag)

Parameter Type Description

inSourceObject Longint A handle to an object

inSourceTag String An item tag

inDestObject Longint A handle to an object

inDestTag String An item tag

Discussion

OT CopyItem copies the item referenced by inSourceTag to the item referenced by inDestTag. The item referenced by inDestTag need not exist; it will be created if necessary. The source and destination objects may be the same, allowing either duplication of an item at the same level of embedding within an object, or copying an item from one level of embedding to another.

If either object handle is not valid, or if the source item does not exist, or if the source item and destination item do not have the same type, an error is generated, OK is set to zero, and no copy is performed.

Note Copying an embedded object copies all of its items.

OT DeleteItem version 1

OT DeleteItem(inObject; inTag)

Parameter Type Description

inObject Longint A handle to an object

inTag String Tag of the item to delete

Discussion

OT DeleteItem deletes an item from an object. inTag may refer to embedded items and objects.

If inObject is not a valid object handle or inTag refers to an item that does not exist, an error is generated, OK is set to zero, and no delete is performed.

Note Deleting an embedded object deletes all of its items.



Topics of Interest
Object Utility Routines
Array Utility Routines
Command Reference
 

Published date: Fri, 14 Jul 2006 18:56:48 GMT   → View XML Version

Edit this page now

© 2005 - 2006 4dquiz.com, All trademarks accepted. All Rights Reserved!
Site Index