ipInSubnet
Description
Return true if an IP address belongs to a given subnet, otherwise return false.
Syntax
Like many functions in DataPrime, ipInSubnet supports two notations, function and method notation. These interchangeable forms allow flexibility in how you structure expressions.
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
| ip | string | true | The IP address to test |
| ipPrefix | string | true | The CIDR range to check against, e.g. 154.67.8.0/24 |
Example
Use case: Filter documents by subnet membership
Check if the field ip_address belongs to the subnet 154.67.8.0/24. Documents with matching IPs are included in the result set, while others are excluded.
Example data
Example query
Example output
Theme
Light