Leaf Class Methods

In this section, we discuss the Leaf class methods. The methods are discussed in alphabetical order.

Syntax

Cut()

Description

The Cut method cuts the leaf and puts it into a buffer (the clipboard.) You can then use the PasteSib method to add the leaf back as a sibling of a different leaf. You can also use the PasteChild node method to add the leaf back as a child of a different node.

You can only have one object at a time on the clipboard. If you cut another leaf or node, the leaf in the clipboard is overwritten.

Parameters

None.

Returns

A number; 0 if the cut is successful.

Syntax

Delete()

Description

The Delete method deletes the leaf object executing the method from the database.

Returns

A number; 0 if the delete is successful.

Example

&MYLEAF = &MYTREE.FindLeaf("8200", "8300"); 
&MYLEAF.Delete();

Syntax

DeleteByRange(RangeFrom, RangeTo)

Description

The DeleteByRange method deletes the specified leaf object from the database. The leaf specified by the parameters does not have to match the leaf executing the method. That is, if &MYLEAF is associated with a range 8200-8300, you can specify a different range with the DeleteByRange method. For example:

&MYLEAF = &MYTREE.FindLeaf("8200", "8300"); 
/* some processing */ 
&RET_VALUE = &MYLEAF.DeleteByRange("8400", "8500");

Parameters

Field or Control

Definition

RangeFrom

Specify the starting range of the leaf to be deleted. This parameter takes a string value.

RangeTo

Specify the ending range of the leaf to be deleted. This parameter takes a string value.

Returns

A number; 0 if the delete is successful.

Example

&RET_VALUE= &MYLEAF.DeleteByRange("8400", "8500");

Syntax

GenABNMenuElement()

Description

Note: SmartNavigation has been deprecated. This method remains for backward compatibility only.

Use this method to generate a single <li> element for this tree leaf.

The <li> element from this leaf and the <li> elements from its sibling leaves and nodes are concatenated to form an HTML code fragment to be consumed by the portal.

Parameters

None.

Returns

A string representing the <li> element for this tree leaf.

Syntax

GenABNMenuElementWithImage(CREF_img_class_ID)

Description

Note: SmartNavigation has been deprecated. This method remains for backward compatibility only.

Use this method to generate a single <li> element for this tree leaf using the specified custom CREF icon.

The <li> element from this leaf and the <li> elements from its sibling leaves and nodes are concatenated to form an HTML code fragment to be consumed by the portal.

Parameters

Field or Control

Definition

CREF_img_class_ID

Specifies the class ID for a custom CREF icon as a string. This class must be defined in a style sheet, and the style sheet must be assigned to the SmartNavigation folder.

This is an optional parameter. To use the default CREF icon, you can omit this parameter or specify the null string "". However, to ensure forward compatibility, you must specify the null string.

Returns

A string representing the <li> element for this tree leaf.

Syntax

InsertDynSib()

Description

The InsertDynSib method inserts a dynamic leaf as a sibling leaf to the leaf object executing the method. The leaf is a new node.

A leaf object associated with the new leaf is returned. The new leaf is inserted as the next sibling leaf. If the new leaf isn’t inserted successfully, the method returns Null.

Note: To insert a sibling leaf with a specific range, use the InsertSib method.

Parameters

None.

Returns

A reference to the new leaf. If this method fails, it returns either False or a Null object reference, depending upon the type of error encountered. The best way to test whether the object was inserted is to test the result using either the All or None functions.

Example

&NEWLEAF = &MYLEAF.InsertDynSib();

Syntax

InsertSib(RangeFrom, RangeTo)

Description

The InsertSib method inserts a new leaf as a sibling leaf under the leaf currently executing the method. The leaf specified by the range parameters must be a new leaf. You receive an error if the leaf already exists.

A leaf object associated with the new leaf is returned. The new leaf is inserted as the next sibling leaf, although there is no explicit ordering of leaves: leaves take the order of the alphanumeric database sort on their range fields.

Note: To insert a dynamic sibling leaf (that is, without specifying a range) use the InsertDynSib method.

Parameters

Field or Control

Definition

RangeFrom

Specify the starting range of the new leaf. This parameter takes a string value.

RangeTo

Specify the ending range of the new leaf. This parameter takes a string value.

Returns

A leaf object associated with the new leaf. If this method fails, it returns either False or a Null object reference, depending upon the type of error encountered. The best way to test whether the object was inserted is to test the result using either the All or None functions.

Example

&NEWLEAF = &MYLEAF.InsertSib("10090", "10100");

Syntax

LoadABNChart(&chart_rowset, &relactions_rowset)

Description

Note: SmartNavigation has been deprecated. This method remains for backward compatibility only.

Use this method to load a child leaf of the current tree node into the SmartNavigation chart rowset and the component buffer.

Parameters

Field or Control

Definition

&chart_rowset

Specifies the SmartNavigation chart rowset. Typically, this is the rowset returned by the GetABNChartRowSet function.

&relactions_rowset

Specifies the related actions rowset. Typically, this is the rowset returned by the GetABNRelActnRowSet function.

Returns

None.

Syntax

LoadABNChartOrdered(&chart_rowset, &relactions_rowset, order)

Description

Note: SmartNavigation has been deprecated. This method remains for backward compatibility only.

Use this method to load a child leaf of the current tree node into the SmartNavigation chart rowset and the component buffer. The order for the leaf within its chart level is specified by this method.

Parameters

Field or Control

Definition

&chart_rowset

Specifies the SmartNavigation chart rowset. Typically, this is the rowset returned by the GetABNChartRowSet function.

&relactions_rowset

Specifies the related actions rowset. Typically, this is the rowset returned by the GetABNRelActnRowSet function.

order

Specify the order for the leaf as a number.

Note: For a given chart level, all chart leaves must have a display order greater than zero.

Returns

None.

Syntax

MoveAsChild(Node)

Description

The MoveAsChild method moves the leaf executing the method to a different node in the tree. The leaf becomes the first child leaf under the node, even though there is no explicit ordering of leaves: leaves take the order of the alphanumeric database sort on their range fields. The specified node becomes the new parent to the leaf.

Parameters

Field or Control

Definition

Node

Specify a node object. This parameter value must be an object, not a string or a name.

Note: To specify a node name, not a node object, use the MoveAsChildByName method.

Returns

A number; 0 if the move is successful.

Example

The following example moves leaf 8001 from node 10100 (old parent) to node 00001 (new parent)

&MY_LEAF = &MY_TREE.FindLeaf("8001", "8001"); 
&NEW_PARENT = &MY_TREE.FindNode("00001", ""); 
If &NEW_PARENT <> Null Then 
   &RET_VALUE = &MY_LEAF.MoveAsChild(&NEW_PARENT); 
End-If;

Syntax

MoveAsChildByName(NodeName)

Description

The MoveAsChildByName method moves the leaf executing the method to a different node in the tree. The leaf becomes the first child leaf under the node, although there is no explicit ordering of leaves: leaves take the order of the alphanumeric database sort on their range fields. The specified node becomes the new parent to the leaf. The node specified by NodeName must be a valid node name.

Parameters

Field or Control

Definition

NodeName

Specify the name of a node. NodeName must be a valid node for the existing tree. This parameter takes a string value.

Note: To specify a node object, not a node name, use the MoveAsChild method.

Returns

A number; 0 if the move is successful.

Example

The following example moves leaf 8001 from node 10100 (old parent) to node 00001 (new parent)

&MY_LEAF = &MY_TREE.FindLeaf("8001", "8001"); 
If &MY_LEAF <> Null Then 
   &RET_VALUE = &MY_LEAF.MoveAsChildByName("00001"); 
End-If;

Syntax

MoveAsSib(Leaf)

Description

The MoveAsSib method moves the leaf executing the method to a new place in the tree. The current leaf becomes the next sibling leaf under the specified leaf object, although there is no explicit ordering of leaves: leaves take the order of the alphanumeric database sort on their range fields.

Parameters

Field or Control

Definition

Leaf

Specify a leaf object. This parameter value must be an object, not a string or a name.

Note: To specify a range, not a leaf object, use the MoveAsSibByRange method.

Returns

A number; 0 if the move is successful.

Example

&MYLEAF = &MYTREE.FindLeaf("8000", "8000"); 
&MYLEAF2 = &MYTREE.FindLeaf("9000", "9000"); 
&RET_VALUE = &MYLEAF.MoveAsSib(&MYLEAF2);

Syntax

MoveAsSibByRange(RangeFrom, RangeTo)

Description

The MoveAsSibByRange method moves the leaf executing the method to a new place in the tree. The current leaf becomes the next sibling leaf under the specified leaf object.

Parameters

Field or Control

Definition

RangeFrom

Specify the starting range of the leaf that you want as the parent of the leaf executing the method. This parameter takes a string value.

RangeTo

Specify the ending range of the leaf that you want as the parent of the leaf executing the method. This parameter takes a string value.

Note: To specify a leaf object, not a range, use the MoveAsSib method.

Returns

A number; 0 if the move is successful.

Example

&MYLEAF = &MYTREE.FindLeaf("8000", "8000"); 
&RET_VALUE = &MYLEAF.MoveAsSibByRange("9000", "9000");

Syntax

PasteSib()

Description

The PasteSib method makes the leaf from the buffer (clipboard) a sibling to the leaf executing the method. You must use the Cut leaf method before you can paste a leaf.

You can have only one object at a time on the clipboard. If you cut another leaf or node, the leaf in the clipboard is overwritten.

Parameters

None.

Returns

A number; 0 if the paste is successful.

Syntax

RefreshDescription(expand_range)

Description

Use this method to reload the tree leaf’s description from the database.

Note: This method is currently supported for what is known as a single detail leaf. Do not use this method with ranged or dynamic leaves.

Parameters

Field or Control

Definition

expand_range

Specify a Boolean value; however, this parameter is currently ignored.

Note: This parameter is reserved for future use.

Returns

A number: 0 if the refresh was successful.

Syntax

UpdateRanges(RangeFrom, RangeTo)

Description

The UpdateRanges method performs validation of edited ranges, updating as necessary.

Parameters

Field or Control

Definition

RangeFrom

Specify the starting range of the leaf that you updated. This parameter takes a string value.

RangeTo

Specify the ending range of the leaf you want updated. This parameter takes a string value.

Returns

A number; 0 if the update is successful.