Top-level Expression
The top-level expression is the expression that defines the results of the check. The top-level expression must evaluate to a bag or list of records. See the guide on collections for more information about bags and lists.
In order to prevent overly large query results, NQE automatically rewrites checks whose resulting record's fields' values are not simple. A simple value is defined as a value that is either a basic value or a bag or list of basic values, where a basic value is defined as:
- A value of a primitive type, like
string,number,boolean, oripAddress,ipSubnet,macAddress, or - An enumerated value.
For example, a list of string is a simple value, whereas a list of lists of string is not simple.
Whenever a returned record has a field whose value is not simple, that value is converted to a string. For example,
this query:
foreach device in network.devices
select { name: device.name, device: device }
will be rewritten to:
foreach device in network.devices
select { name: device.name, device: toStringTruncate(device) }
since device.name is a simple value (a string), but device is not a simple value. For more information on the
behaviour of toStringTruncate, please see toString.