Find an Answer
num_children() — Counts the number of child nodes of a parent node.
The num_children() function returns a tree and takes a tree parameter:
tree num_children(tree input)
The num_children() function returns a tree.
The num_children() function finds the number of child nodes of a parent node. The num_children() function takes 1 parameter.
You can try the following examples against your own data in the GoToAssist search field, or against fictitious data in the Query Sandbox:
Query: How many children does each interface have?
SELECT num_children(interface) FROM /network/device
Results: Depending on the database, this query returns results similar to this:
row num_children(interface)5 row num_children(interface)26 row num_children(interface)2 row num_children(interface)174 . . .
Query: How many children do the Directory Items properties have?
SELECT properties/name, num_children(properties) FROM /directory/item
Results: Depending on the database, this query returns results similar to this:
row /properties/name VOLANS num_children(properties) 20 row /properties/name EARTH num_children(properties) 15 row /properties/name JUPITER num_children(properties) 16 row /properties/name GRUS num_children(properties) 21 . . .
Query: How many child nodes do the systems with low disk space have?
SELECT num_children(systemname) FROM %free disk space% WHERE freespace < 1000000000 AND description = 'Local Fixed Disk'
Results: Depending on the database, this query returns results similar to this:
SELECT num_children(systemname) FROM %free disk space% WHERE freespace < 1000000000 AND description = 'Local Fixed Disk'
Results: Depending on the database, this query returns results similar to this:
row has_history(systemname) 0 row has_history(systemname) 0 row has_history(systemname) 0
To see other PQL functions, see Functions.
Related topics