-
Notifications
You must be signed in to change notification settings - Fork 11
Row queries
David Megginson edited this page Dec 7, 2016
·
1 revision
libhxl current uses row queries for the hxlselect command-line script, and the with_rows() and without_rows() filters, but will likely extend them to other uses in the future. The query selects a row by combining a tag pattern with an operator and a value, like this:
org+name=unicef
This query selects every row where the value "unicef" (case-insensitive) appears in a column that matches the tag pattern "org+name" (note that the tag pattern omits the initial '#' — it is optional in queries and most other places that tag patterns appear.)
The following operators are available:
Operator | Description | Example |
---|---|---|
= |
The value appears in a column matching the tag pattern. | org+name=unicef |
!= |
The value does not appear in a column matching the tag pattern. | status+code!=completed |
< |
The content of the column is numerically or lexically less than the value provided. | targeted<300 |
<= |
The content of the column is numerically or lexically less than or equal to the value provided. | population+f<=20000 |
> |
The content of the column is numerically or lexically great than the value provided. | population+f>20000 |
>= |
The content of the column is numerically or lexically great than or equal to the value provided. | contact+name>=m |
~ |
The content of the column matches the [regular expression](https://docs.python.org/2/howto/regex.html) provided. | activity.name~vaccination |
!~ |
The content of the column does not match the regular expression provided. | status!~^(planned|completed)$ |
- Matching is always case-insensitive:
org=UNICEF
andorg=unicef
will match the same rows. - The leading
#
is optional in the tag pattern:org=red cross
and#org=red cross
will match the same rows. - Strings are always complete matches; regular expressions can match just part of the content (use
^
and$
to constrain to a full match). - Leading and trailing whitespace is always removed, and remaining whitespace, normalised, before matching.
Standard: http://hxlstandard.org | Mailing list: [email protected]