Difference between revisions of "NXSL:GetCustomAttribute"

From NetXMS Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ Get value of node's custom attribute. Function returns requested attribute's value on success or NULL if given attribute does not exist. == Syntax == GetCustomAttri...")
 
Line 3: Line 3:


== Syntax ==
== Syntax ==
GetCustomAttribute(node, attributeName)
GetCustomAttribute(''node'', ''attributeName'')


== Parameters ==
== Parameters ==
{| class="wikitable"
{| class="wikitable"
|-
|-
| node || [[NXSL:Node|Node]] object, you can use predefined variable $node to refer to current node. You can also use null as node if trusted nodes check is disabled (see [[SG:Security Issues|Security Issues]] for more information).
| ''node'' || [[NXSL:Node|Node]] object, you can use predefined variable $node to refer to current node. You can also use null as node if trusted nodes check is disabled (see [[SG:Security Issues|Security Issues]] for more information).
|-
|-
| attributeName || Custom attribute name.
| ''attributeName'' || Custom attribute name.
|}
|}


Line 22: Line 22:
== Examples ==
== Examples ==


GetCustomAttribute($node, "my_attribute") -> "my value"
GetCustomAttribute($node, "my_attribute") -> "my value"
 
GetCustomAttribute($node, "bad_attribute_name") -> NULL
GetCustomAttribute($node, "bad_attribute_name") -> NULL

Revision as of 12:48, 6 July 2012

Get value of node's custom attribute. Function returns requested attribute's value on success or NULL if given attribute does not exist.

Syntax

GetCustomAttribute(node, attributeName)

Parameters

node Node object, you can use predefined variable $node to refer to current node. You can also use null as node if trusted nodes check is disabled (see Security Issues for more information).
attributeName Custom attribute name.

Return Value

String value of custom attribute or NULL if attribute is missing.

Notes

If attribute name conforms to NXSL identifier naming conventions, it can be accessed directly as node object attribute. For example “GetCustomAttribute($node, "my_attribute")” can be changed to “$node->my_attribute”

Examples

GetCustomAttribute($node, "my_attribute")		-> "my value"
GetCustomAttribute($node, "bad_attribute_name")	-> NULL