Field functions¶
Field functions allow users to manipulate and extract data from fields when applying sorting and filtering operations. This section describes the available functions and their usage with the FunQL language.
Datetime functions¶
These functions extract specific components from DateTime
values, such as the year, month, or hour.
Function list¶
Name | Summary |
---|---|
year |
Returns the year component of a DateTime value. |
month |
Returns the month component of a DateTime value. |
day |
Returns the day of the month component of a DateTime value. |
hour |
Returns the hour component of a DateTime value. |
minute |
Returns the minute component of a DateTime value. |
second |
Returns the second component of a DateTime value. |
millisecond |
Returns the millisecond component of a DateTime value. |
year¶
The year
function has the following signature:
The year
function returns the year component of a DateTime
parameter value.
For example:
{
"name": "LEGO Star Wars Millennium Falcon",
"setNumber": 75192,
"price": 849.99,
"launchTime": "2017-10-01T14:15:30.500Z"
}
Usage
Return all sets that were launched in 2017:
month¶
The month
function has the following signature:
The month
function returns the month component of a DateTime
parameter value. The month is given as an integer,
ranging from 1 (January) to 12 (December).
For example:
{
"name": "LEGO Star Wars Millennium Falcon",
"setNumber": 75192,
"price": 849.99,
"launchTime": "2017-10-01T14:15:30.500Z"
}
Usage
Return all sets that were launched in October, the 10th month of the year:
day¶
The day
function has the following signature:
The day
function returns the day component of a DateTime
parameter value. The day is given as an integer, ranging
from 1 to 31.
For example:
{
"name": "LEGO Star Wars Millennium Falcon",
"setNumber": 75192,
"price": 849.99,
"launchTime": "2017-10-01T14:15:30.500Z"
}
Usage
Return all sets that were launched on the 1st day of a month:
hour¶
The hour
function has the following signature:
The hour
function returns the hour component of a DateTime
parameter value. The hour is given as an integer, ranging
from 0 (12:00 A.M.) to 23 (11:00 P.M.).
For example:
{
"name": "LEGO Star Wars Millennium Falcon",
"setNumber": 75192,
"price": 849.99,
"launchTime": "2017-10-01T14:15:30.500Z"
}
Usage
Return all sets that were launched in the 14th hour of a day:
minute¶
The minute
function has the following signature:
The minute
function returns the minute component of a DateTime
parameter value. The minute is given as an integer,
ranging from 0 to 59.
For example:
{
"name": "LEGO Star Wars Millennium Falcon",
"setNumber": 75192,
"price": 849.99,
"launchTime": "2017-10-01T14:15:30.500Z"
}
Usage
Return all sets that were launched in the 15th minute of any hour on any day:
second¶
The second
function has the following signature:
The second
function returns the second component of a DateTime
parameter value. The second is given as an integer,
ranging from 0 to 59.
For example:
{
"name": "LEGO Star Wars Millennium Falcon",
"setNumber": 75192,
"price": 849.99,
"launchTime": "2017-10-01T14:15:30.500Z"
}
Usage
Return all sets that were launched in the 30th second of any minute of any hour on any day:
millisecond¶
The millisecond
function has the following signature:
The millisecond
function returns the millisecond component of a DateTime
parameter value. The millisecond is given
as an integer, ranging from 0 to 999.
For example:
{
"name": "LEGO Star Wars Millennium Falcon",
"setNumber": 75192,
"price": 849.99,
"launchTime": "2017-10-01T14:15:30.500Z"
}
Usage
Return all sets that were launched in the 500th millisecond of any second of any minute of any hour on any day:
Math functions¶
These functions round numerical values in different ways.
Function list¶
Name | Summary |
---|---|
round |
Rounds a number to the nearest integer. |
floor |
Rounds a number down to the nearest integer. |
ceiling |
Rounds a number up to the nearest integer. |
round¶
The round
function has the following signature:
The round
function rounds the input parameter numeric value to the nearest numeric value with no decimal component.
FunQL uses away-from-zero rounding, meaning midpoint values (e.g., 0.5) are rounded to the next whole number away from zero. For example, 0.5 is rounded to 1 and ‑0.5 is rounded to -1.
For example:
{
"name": "LEGO Star Wars Millennium Falcon",
"setNumber": 75192,
"price": 849.99,
"launchTime": "2017-10-01T14:15:30.500Z"
}
Usage
Return all sets that have a price that rounds to 850:
floor¶
The floor
function has the following signature:
The floor
function rounds the input parameter numeric value down to the nearest numeric value with no decimal
component.
For example:
{
"name": "LEGO Star Wars Millennium Falcon",
"setNumber": 75192,
"price": 849.99,
"launchTime": "2017-10-01T14:15:30.500Z"
}
Usage
Return all sets that have a price that rounds down to 849:
ceiling¶
The ceiling
function has the following signature:
The ceiling
function rounds the input parameter numeric value up to the nearest numeric value with no decimal
component.
For example:
{
"name": "LEGO Star Wars Millennium Falcon",
"setNumber": 75192,
"price": 849.99,
"launchTime": "2017-10-01T14:15:30.500Z"
}
Usage
Return all sets that have a price that rounds up to 850:
String functions¶
These functions modify string values by changing their case.
Function list¶
Name | Summary |
---|---|
lower |
Converts a string to lowercase. |
upper |
Converts a string to uppercase. |
lower¶
The lower
function has the following signature:
The lower
function returns the input parameter string value with all uppercase characters converted to lowercase
according to Unicode rules.
For example:
{
"name": "LEGO Star Wars Millennium Falcon",
"setNumber": 75192,
"price": 849.99,
"launchTime": "2017-10-01T14:15:30.500Z"
}
Usage
Return all sets that have a name that equals 'lego star wars millennium falcon' once any uppercase characters have been converted to lowercase:
upper¶
The upper
function has the following signature:
The upper
function returns the input parameter string value with all lowercase characters converted to uppercase
according to Unicode rules.
For example:
{
"name": "LEGO Star Wars Millennium Falcon",
"setNumber": 75192,
"price": 849.99,
"launchTime": "2017-10-01T14:15:30.500Z"
}
Usage
Return all sets that have a name that equals 'LEGO STAR WARS MILLENNIUM FALCON' once any lowercase characters have been converted to uppercase: