Node Class Methods

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

Syntax

Branch()

Description

The Branch method branches the node executing this method, identifying all of its child nodes and leaves as part of that branch. Branching means taking a limb of a tree and creating another subtree to hold that limb. (Technically is it not creating a real tree.) The subtree is accessed through the Branches collection.

After you use the Branch method, you can no longer access the child nodes and leaves of the node that executed the method until you close the current tree, open the new branched tree, and find the node again. To unbranch the tree, use the Unbranch method.

Returns

A number; 0 if method is successful.

Example

&MYNODE = &MYTREE.FindNode("10900", ""); 
&MYNODE.Branch();

Syntax

Cut()

Description

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

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

Parameters

None.

Returns

A number; 0 if method is successful.

Syntax

Delete()

Description

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

Returns

A number; 0 if method is successful.

Syntax

DeleteByName(NodeName)

Description

The DeleteByName method deletes the specified node from the database. The NodeName parameter takes a string value. The node specified by NodeName does not have to match the node executing the method. That is, if &MYNODE is associated with node 100200, you can specify a different node with the DeleteByName method. For example:

&MYNODE = &MYTREE.FindNode("100200", ""); 
/* some processing */ 
&MYNODE.DeleteByName("100300");

The node name specified by NodeName must be a valid node in the existing open tree object. If NodeName doesn’t exist, you receive a runtime error.

Returns

A number; 0 if method is successful.

Syntax

Expand(ExpandType)

Description

The Expand method gets the next level of nodes or leaves into memory from the selected node. What leaves or nodes get expanded depends on the ExpandType.

Parameters

Field or Control

Definition

ExpandType

Specifies which leaves or nodes get expanded. Values are:

Value

Description

0

Expand only nodes

1

Expand nodes and leaves

2

Expand only one level

Returns

A number; 0 if method is successful.

Example

If (&MYNODE.State = 2 AND &MYNODE.HasChildren); 
   /* if node is collapsed */ 
   &MYNODE.Expand(2); 
End-if; 

Syntax

GenABNMenuElement(initial_node)

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 node.

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

Parameters

Field or Control

Definition

initial_node

Specifies the initial chart node. Typically, this is returned directly by calling the GetABNInitialNode function.

Returns

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

Syntax

GenABNMenuElementWithImage(initial_node, fldr_img_class_ID, 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 node using the specified custom folder and CREF icons.

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

Parameters

Field or Control

Definition

initial_node

Specifies the initial chart node. Typically, this is returned directly by calling the GetABNInitialNode function.

fldr_img_class_ID

Specifies the class ID for a custom folder 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 folder icon, you can omit this parameter or specify the null string "". However, to ensure forward compatibility, you must specify the null string.

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 node.

Syntax

GenBreadCrumbs(list)

Description

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

Call the GenBreadCrumbs method from the requested node to generate an HTML code fragment that will be rendered in the browser as breadcrumbs.

The <li> elements in the input string are created by the GenRelatedActions and GenABNMenuElement methods of the Node class, and the GenABNMenuElement method of the Leaf class.

Parameters

Field or Control

Definition

list

Specifies the list of <li> elements as a string.

Returns

A string with the <li> elements for the bread crumbs for this tree node appended.

Syntax

GenRelatedActions()

Description

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

Use this method to generate the list of <li> elements for the related actions menu for the current tree node. Call this function before calling GenABNMenuElement for the same node. The <li> elements from this function, from this node, from any child nodes and leaves traversed, and from the parent tree nodes are concatenated to form an HTML code fragment to be consumed by the portal.

Parameters

None.

Returns

A string representing the <li> elements for the related actions for this tree node.

Syntax

InsertChildLeaf(RangeFrom, RangeTo)

Description

The InsertChildLeaf method inserts a new leaf (as specified by the range parameters) under the node object executing the method.

A leaf object associated with the new leaf is returned.

The new leaf is inserted as the child of the current node, although there is no explicit ordering of leaves: leaves take the order of the alphanumeric database sort on their range fields.

Note: You must specify a range with this method. To insert a dynamic range leaf (that is, one with no range) use the InsertDynChildLeaf 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 = &MYLNODE.InsertChildLeaf("10090", "10100");
If None(&NEWLEAF) Then 
   /* Error Processing */ 
End-If;

Syntax

InsertChildNode(NodeName)

Description

The InsertChildNode method inserts a new node (as specified by NodeName) as a child node under the node object executing the method. The node specified by NodeName must be a new node. You receive an error if the node already exists.

A node object associated with the new node is returned. If the new node isn’t inserted successfully, the method returns False or Null.

Parameters

Field or Control

Definition

NodeName

Specify a name for the new node. This parameter takes a string value. NodeName must not already exist.

Returns

A reference to the new node. 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

&NEWNODE = &MYNODE.InsertChildNode("100500");
If None(&NEWNODE) Then 
   /* Do error processing */ 
End-If;

Syntax

InsertChildRecord(NodeName)

Description

The InsertChildRecord method inserts a new record (as specified by NodeName) as a node under the parent node executing this method. This method works only on trees that are Query Access Trees.

A node object associated with the new node is returned, otherwise this method returns False or Null.

Parameters

Field or Control

Definition

NodeName

Specify an existing record name. This parameter takes a string value. This record must not already be a node under the parent node (that is, a parent node can’t have the same record as a child node more than once.)

Returns

A reference to the new node. 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

&NEWNODE = &MYNODE.InsertChildRecord("PERSONAL_DATA");
If None(&NEWNODE) Then 
   /* Do error processing */ 
End-if;

Syntax

InsertDynChildLeaf()

Description

The InsertDynChildLeaf method inserts a dynamic leaf under the node object executing the method.

A leaf object associated with the new leaf is returned.

The new leaf is inserted as the child of the current node, although there is no explicit ordering of leaves.

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

Parameters

None.

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 = &MYLNODE.InsertDynChildLeaf();
If None(&NEWLEAF) Then 
   /* Do error processing */ 
End-If;

Syntax

InsertSib(NodeName)

Description

The InsertSib method inserts a new node (as specified by NodeName) as a sibling node to the node object executing the method. The node specified by NodeName must be a new node. You receive an error if the node already exists.

A node object associated with the new node is returned. If the new node isn’t inserted successfully, the method returns Null.

Parameters

Field or Control

Definition

NodeName

Specify a name for the new node. This parameter takes a string value. NodeName must not already exist.

Returns

A reference to the new node. If this method fails, it returns False.

Example

&NEWNODE = &MYNODE.InsertSib("100500");

Syntax

InsertSibRecord(NodeName)

Description

The InsertSibRecord method inserts a new record (as specified by NodeName) as a sibling node of the parent node executing this method. This method works only on trees that are Query Access Trees.

A node object associated with the new node is returned, otherwise this method returns Null.

Parameters

Field or Control

Definition

NodeName

Specify an existing record name. This parameter takes a string value. This record must not already be a sibling node for the node executing the object (that is, a node can’t have the same record as a node more than once.)

Returns

A reference to the new node. If this method fails, it returns False.

Example

&NEWNODE = &MYNODE.InsertSibRecord("PERSONAL_DATA");

Syntax

LoadABNChart(&chart_rowset, &relactions_rowset, requested_node, initial_node)

Description

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

Use this method to load the requested 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.

requested_node

Specifies as a Boolean value whether the calling node is the requested node.

initial_node

Specifies the initial chart node. Typically, this is returned directly by calling the GetABNInitialNode function.

Returns

None.

Syntax

LoadABNChartOrdered(&chart_rowset, &relactions_rowset, requested_node, initial_node, order)

Description

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

Use this method to load the requested tree node into the SmartNavigation chart rowset and the component buffer. The order for this node 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.

requested_node

Specifies as a Boolean value whether the calling node is the requested node.

initial_node

Specifies the initial chart node. Typically, this is returned directly by calling the GetABNInitialNode function.

order

Specify the order for the node 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 node executing the method to a different node in the tree. The node becomes the first child node under the named node. The specified node becomes the new parent to the child node. The node specified by Node must be an existing node in the current tree. All child nodes and details are also moved with the node.

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 method is successful.

Example

The following example moves node 10200 from node 10100 (old parent) to node 00001 (new parent).

   &MY_NODE = &MY_TREE.FindNode("10200", ""); 
   &NEW_PARENT = &MY_TREE.FindNode("00001", ""); 
   If &NEW_PARENT <> Null Then 
      &MY_NODE.MoveAsChild(&NEW_PARENT); 
   End-If;

Syntax

MoveAsChildByName(NodeName)

Description

The MoveAsChildByName method moves the node executing the method to a different node in the tree. The node becomes the first child node under the parent node. The specified node becomes the new parent to the node. The node specified by NodeName must be a valid node name. All child nodes and details are also moved with the node.

Parameters

Field or Control

Definition

NodeName

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

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

Returns

A number; 0 if method is successful.

Example

The following moves node 10200 from node 10100 (old parent) to node 00001 (new parent)

   &MY_NODE = &MY_TREE.FindNode("10200", ""); 
   If &MY_NODE <> Null Then 
      &MY_NODE.MoveAsChildByName("00001"); 
   End-If;

Syntax

MoveAsSib(Node)

Description

The MoveAsSib method moves the node executing the method to a new place in the tree. The current node becomes the next sibling node under the specified node. All child nodes and details are also moved with the node.

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 MoveAsSibByName method.

Returns

A number; 0 if method is successful.

Example

&MYNODE = &MYTREE.FindNode("20000", ""); 
&MYNODE2 = &MYTREE.FindNode("20100", ""); 
&MYNODE.MoveAsSib(&MYNODE2);

Syntax

MoveAsSibByName(NodeName)

Description

The MoveAsSibByName method moves the node executing the method to a new place in the tree. The current node becomes the next sibling node under the specified node. All child nodes and details are also moved with the node.

Parameters

Field or Control

Definition

NodeName

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

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

Returns

A number; 0 if method is successful.

Example

&MYNODE = &MYTREE.FindNode("20000", ""); 
&MYNODE.MoveAsSibByName("10100");

Syntax

PasteChild()

Description

The PasteChild method makes the node or leaf from the buffer (clipboard) a child to the node executing the method. You must use the Cut node or leaf method before you can paste a node or leaf.

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

Parameters

None.

Returns

A number; 0 if method is successful.

Syntax

PasteSib()

Description

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

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

Parameters

None.

Returns

A number; 0 if method is successful.

Syntax

RefreshDescription()

Description

The RefreshDescription method enables you to change the description of a node on a page and have the update be displayed immediately. If you don't use RefreshDescription, you must save the tree and reopen it for the change to be displayed.

Parameters

None.

Returns

A zero (0) if description is refreshed successfully, a different error number otherwise.

Example

&result= &NodeObj.refreshdescription();

Syntax

Rename(NodeName)

Description

The Rename method renames the node object executing the method without changing any other properties. The parameter NodeName takes a string value. The node specified by NodeName must be a new node. You receive an error if the node already exists.

Note: The Rename method does not rename the node in a user node component. Your application needs to do that.

Returns

A number; 0 if method is successful.

Example

&MYNODE = &MYTREE.FindNode("10900", ""); 
&MYNODE.Rename("10200");

Syntax

SwitchLevel(NewLevelNumber)

Description

The SwitchLevel methods enables you to move a node down from one level to another.

NewLevelNumber must specify a valid level number. For trees in which the Level Use parameter is set to Strictly Enforce Levels, the new level must be at least one level lower than the node’s parent level.

If the level specified by NewLevelNumber doesn't exist, it's automatically generated and added to the tree.

Parameters

Field or Control

Definition

NewLevelNumber

Specify the level number to where you want the node moved.

Returns

A zero (0) if node is moved successfully, a different error number otherwise.

Syntax

Unbranch()

Description

The Unbranch method is the opposite of the Branch method: that is, it unbranches the node executing the method if it is branched. All of the child node and leaves of the node become part of the current open tree and accessible in that tree. You can’t unbranch the Root Node in a branched tree.

If the node executing the method isn’t branched, you receive a runtime error. Use the IsBranched property to make sure a node is branched.

Returns

A number; 0 if method is successful.

Example

&MYNODE = &MYTREE.FindNode("10900", ""); 
&MYNODE.Unbranch();