TreeNode::isValidObjectName Method

Determines whether the string passed as an argument can be used as a name for a node in the Application Object Tree (AOT).

Syntax

client server public static boolean isValidObjectName(str name)

Run On

Called

Parameters

  • name
    Type: str
    The string that contains the tree node name to validate.

Return Value

Type: boolean
true if each condition is met; otherwise false.

Remarks

A candidate name must meet the following conditions:

  • The first character must be a letter.

  • It can only contain letters, numbers or an underscore.

  • It must not evaluate to a token.

This method does not check if an element of the same name already exists. It only validates that the argument is a valid name for an AOT object. Duplicate names may not exist within classes, tables, extended data types, or enums.

Examples

The following example gives examples of valid and invalid arguments.

boolean validName; 
 
validName = TreeNode::isValidObjectName('ValidName'); //true 
validName = TreeNode::isValidObjectName('Name with spaces'); //false 
validName = TreeNode::isValidObjectName('4StartsWithDigit'); //false 
validName = TreeNode::isValidObjectName('Illegal;Character'); //false 
validName = TreeNode::isValidObjectName('if'); // false (token name)

See Also

TreeNode Class

TreeNode.AOTinsert Method