Atomic Functions¶
- type str¶
Strings in Beanquery should be enclosed in single quotes. Example:
SELECT * FROM payee == 'Supermarket'.Note: For historical reasons, strings in double quotes can sometimes be used, but if they match a column name, they will be interpreted as this column name, not a string. Do not use them.
- type bool¶
This represents a logical value (yes/no). The acceptable values are
TRUEorFALSE.
- type set¶
This represents a set of values, for example all accounts that are touched by a transaction.
- type int¶
A whole number, -1, 0, 1, 2…
- type decimal¶
This is a decimal number, as used for example for amounts of currencies or commodities. Example: 1.25.
The following functions can be used to work on basic types:
abs()- Absolute value.date()- Convert the argument to a date.decimal()- Convert the object to a decimal number.findfirst()- Filter a string sequence by regular expression and return the first match.getitem()- Get one item from a dict object if it exists, otherwise a default value.grep()- Match a regular expression against a string and return only the matched portion.grepn()- Match a pattern with subgroups against a string and return the subgroup at the index.int()- Convert the object to an integer number.joinstr()- Join a sequence of strings to a single comma-separated string.length()- Compute the length of the argument.lower()- Convert string to lowercase.maxwidth()- Convert the argument to a substring.neg()- Negative value.parse_date()- Parse date from string (first argument).possign()- Correct sign of an Amount based on the usual balance of associated account.round()- Round the argument.safediv()- A division operation that traps division by zero exceptions and outputs zero instead.splitcomp()- Split a string and extract one of its components.subst()- Substitute leftmost non-overlapping occurrences of pattern by replacement.substr()- Extract a substring of the argument.upper()- Convert string to uppercase.