Data-Mate Functions
CATEGORY: Boolean
isBoolean
Type: FIELD_VALIDATION
Returns the input if it is a boolean, otherwise returns null
Examples
# Example (1)
isBoolean()
'TRUE'
null
# Example (2)
isBoolean()
false
false
# Example (3)
isBoolean()
1
null
# Example (4)
isBoolean()
102
null
# Example (5)
isBoolean()
'example'
null
isBooleanLike
Type: FIELD_VALIDATION
Returns the input if it can be converted to a boolean, otherwise returns null
Examples
# Example (1)
isBooleanLike()
'TRUE'
'TRUE'
# Example (2)
isBooleanLike()
'false'
'false'
# Example (3)
isBooleanLike()
1
1
# Example (4)
isBooleanLike()
102
null
# Example (5)
isBooleanLike()
'example'
null
toBoolean
Type: FIELD_TRANSFORM
Converts the input into a boolean and returns the boolean value
Examples
# Example (1)
toBoolean()
'TRUE'
true
# Example (2)
toBoolean()
1
true
# Example (3)
toBoolean()
0
false
# Example (4)
toBoolean()
null
null
CATEGORY: Geo
geoContains
Type: FIELD_VALIDATION
Returns the input if it contains the value argument, otherwise returns null. The interiors of both geo entities must intersect, and the argument geo-entity must not exceed the bounds of the input geo-entity
Arguments
- value: (required)
Any
- The geo value used to check if it is contained by the input
Accepts
GeoJSON
GeoPoint
Geo
Object
String
Number
Examples
# Example (1)
geoContains({ value: '33.435518,-111.873616' })
'33.435518,-111.873616'
'33.435518,-111.873616'
# Example (2)
geoContains({ value: { type: 'Point', coordinates: [ -111.873616, 33.435518 ] } })
'45.518,-21.816'
null
# Example (3)
geoContains({ value: [ '10,10', '10,50', '50,50', '50,10', '10,10' ] })
{
type: 'Polygon',
coordinates: [ [ [ 0, 0 ], [ 100, 0 ], [ 100, 60 ], [ 0, 60 ], [ 0, 0 ] ] ]
}
{
type: 'Polygon',
coordinates: [ [ [ 0, 0 ], [ 100, 0 ], [ 100, 60 ], [ 0, 60 ], [ 0, 0 ] ] ]
}
# Example (4)
geoContains({
value: {
type: 'MultiPolygon',
coordinates: [
[
[ [ 10, 10 ], [ 10, 50 ], [ 50, 50 ], [ 50, 10 ], [ 10, 10 ] ]
],
[
[
[ -10, -10 ],
[ -10, -50 ],
[ -50, -50 ],
[ -50, -10 ],
[ -10, -10 ]
]
]
]
}
})
{
type: 'MultiPolygon',
coordinates: [
[ [ [ 10, 10 ], [ 10, 50 ], [ 50, 50 ], [ 50, 10 ], [ 10, 10 ] ] ],
[
[
[ -10, -10 ],
[ -10, -50 ],
[ -50, -50 ],
[ -50, -10 ],
[ -10, -10 ]
]
]
]
}
{
type: 'MultiPolygon',
coordinates: [
[ [ [ 10, 10 ], [ 10, 50 ], [ 50, 50 ], [ 50, 10 ], [ 10, 10 ] ] ],
[
[
[ -10, -10 ],
[ -10, -50 ],
[ -50, -50 ],
[ -50, -10 ],
[ -10, -10 ]
]
]
]
}
# Example (5)
geoContains({ value: { type: 'Point', coordinates: [ -30, -30 ] } })
{
type: 'MultiPolygon',
coordinates: [
[ [ [ 10, 10 ], [ 10, 20 ], [ 20, 20 ], [ 20, 10 ], [ 10, 10 ] ] ],
[ [ [ 30, 30 ], [ 30, 40 ], [ 40, 40 ], [ 40, 30 ], [ 30, 30 ] ] ]
]
}
null
geoPointWithinRange
Type: FIELD_VALIDATION
Aliases: geoDistance
Returns the input if it's distance to the args point is less then or equal to the args distance
Arguments
-
point: (required)
Any
- The geo-point used as the center of the geo circle -
distance: (required)
String
- Value of the radius of the geo-circle. It combines the number and the unit of measurement (ie 110km, 20in, 100yards). Possible units are as follows: mi, miles, mile, NM, nmi, nauticalmile, nauticalmiles, in, inch, inches, yd, yard, yards, m, meter, meters, km, kilometer, kilometers, mm, millimeter, millimeters, cm, centimeter, centimeters, ft and feet
Accepts
GeoJSON
GeoPoint
Geo
Object
String
Number
Examples
# Example (1)
geoPointWithinRange({ point: '33.435518,-111.873616', distance: '5000m' })
'33.435967,-111.867710'
'33.435967,-111.867710'
# Example (2)
geoPointWithinRange({ point: '33.435518,-111.873616', distance: '5000m' })
'22.435967,-150.867710'
null
geoDisjoint
Type: FIELD_VALIDATION
Returns the input if it does not have any intersection (overlap) with the argument value, otherwise returns null
Arguments
- value: (required)
Any
- The geo value used to validate that no intersection exists with the input geo-entity
Accepts
GeoJSON
GeoPoint
Geo
Object
String
Number
Examples
# Example (1)
geoDisjoint({ value: [ '10,10', '10,50', '50,50', '50,10', '10,10' ] })
'-33.435967,-111.867710'
'-33.435967,-111.867710'
# Example (2)
geoDisjoint({ value: [ '10,10', '10,50', '50,50', '50,10', '10,10' ] })
{ type: 'Point', coordinates: [ 20, 20 ] }
null
# Example (3)
geoDisjoint({
value: {
type: 'Polygon',
coordinates: [ [ [ 0, 0 ], [ 0, 15 ], [ 15, 15 ], [ 15, 0 ], [ 0, 0 ] ] ]
}
})
{
type: 'Polygon',
coordinates: [ [ [ 20, 20 ], [ 20, 30 ], [ 30, 30 ], [ 30, 20 ], [ 20, 20 ] ] ]
}
{
type: 'Polygon',
coordinates: [ [ [ 20, 20 ], [ 20, 30 ], [ 30, 30 ], [ 30, 20 ], [ 20, 20 ] ] ]
}
# Example (4)
geoDisjoint({
value: {
type: 'Polygon',
coordinates: [ [ [ 0, 0 ], [ 0, 15 ], [ 15, 15 ], [ 15, 0 ], [ 0, 0 ] ] ]
}
})
{
type: 'MultiPolygon',
coordinates: [
[ [ [ 10, 10 ], [ 10, 50 ], [ 50, 50 ], [ 50, 10 ], [ 10, 10 ] ] ],
[
[
[ -10, -10 ],
[ -10, -50 ],
[ -50, -50 ],
[ -50, -10 ],
[ -10, -10 ]
]
]
]
}
null
geoIntersects
Type: FIELD_VALIDATION
Returns the input if it has at least one point in common with the argument value, otherwise returns null
Arguments
- value: (required)
Any
- The geo value used to compare with the input geo-entity
Accepts
GeoJSON
GeoPoint
Geo
Object
String
Number
Examples
# Example (1)
geoIntersects({ value: [ '10,10', '10,50', '50,50', '50,10', '10,10' ] })
{ type: 'Point', coordinates: [ 20, 20 ] }
{ type: 'Point', coordinates: [ 20, 20 ] }
# Example (2)
geoIntersects({ value: [ '10,10', '10,50', '50,50', '50,10', '10,10' ] })
{
type: 'Polygon',
coordinates: [ [ [ 0, 0 ], [ 0, 15 ], [ 15, 15 ], [ 15, 0 ], [ 0, 0 ] ] ]
}
{
type: 'Polygon',
coordinates: [ [ [ 0, 0 ], [ 0, 15 ], [ 15, 15 ], [ 15, 0 ], [ 0, 0 ] ] ]
}
# Example (3)
geoIntersects({
value: {
type: 'Polygon',
coordinates: [ [ [ 0, 0 ], [ 0, 15 ], [ 15, 15 ], [ 15, 0 ], [ 0, 0 ] ] ]
}
})
{
type: 'MultiPolygon',
coordinates: [
[ [ [ 10, 10 ], [ 10, 50 ], [ 50, 50 ], [ 50, 10 ], [ 10, 10 ] ] ],
[
[
[ -10, -10 ],
[ -10, -50 ],
[ -50, -50 ],
[ -50, -10 ],
[ -10, -10 ]
]
]
]
}
{
type: 'MultiPolygon',
coordinates: [
[ [ [ 10, 10 ], [ 10, 50 ], [ 50, 50 ], [ 50, 10 ], [ 10, 10 ] ] ],
[
[
[ -10, -10 ],
[ -10, -50 ],
[ -50, -50 ],
[ -50, -10 ],
[ -10, -10 ]
]
]
]
}
geoRelation
Type: FIELD_VALIDATION
Returns the input if it relates, as specified in the relation argument, to the argument value (defaults to "within"), otherwise returns null
Arguments
-
value: (required)
Any
- The geo value used to compare to the input geo-entity -
relation:
String
- How the geo input should relate the argument value, defaults to "within" : intersects, disjoint, within and contains
Accepts
GeoJSON
GeoPoint
Geo
Object
String
Number
Examples
# Example (1)
geoRelation({ value: [ '10,10', '10,50', '50,50', '50,10', '10,10' ] })
'20,20'
'20,20'
# Example (2)
geoRelation({
value: [ '10,10', '10,50', '50,50', '50,10', '10,10' ],
relation: 'within'
})
'20,20'
'20,20'
# Example (3)
geoRelation({
value: [ '10,10', '10,50', '50,50', '50,10', '10,10' ],
relation: 'contains'
})
'20,20'
null
# Example (4)
geoRelation({
value: {
type: 'Polygon',
coordinates: [ [ [ 0, 0 ], [ 0, 15 ], [ 15, 15 ], [ 15, 0 ], [ 0, 0 ] ] ]
},
relation: 'disjoint'
})
{
type: 'Polygon',
coordinates: [ [ [ 20, 20 ], [ 20, 30 ], [ 30, 30 ], [ 30, 20 ], [ 20, 20 ] ] ]
}
{
type: 'Polygon',
coordinates: [ [ [ 20, 20 ], [ 20, 30 ], [ 30, 30 ], [ 30, 20 ], [ 20, 20 ] ] ]
}
# Example (5)
geoRelation({
value: [ '10,10', '10,50', '50,50', '50,10', '10,10' ],
relation: 'intersects'
})
{
type: 'Polygon',
coordinates: [ [ [ 0, 0 ], [ 0, 15 ], [ 15, 15 ], [ 15, 0 ], [ 0, 0 ] ] ]
}
{
type: 'Polygon',
coordinates: [ [ [ 0, 0 ], [ 0, 15 ], [ 15, 15 ], [ 15, 0 ], [ 0, 0 ] ] ]
}
# Example (6)
geoRelation({
value: [ '10,10', '10,50', '50,50', '50,10', '10,10' ],
relation: 'disjoint'
})
{
type: 'Polygon',
coordinates: [ [ [ 0, 0 ], [ 0, 15 ], [ 15, 15 ], [ 15, 0 ], [ 0, 0 ] ] ]
}
null
geoWithin
Type: FIELD_VALIDATION
Returns the input if it is completely within the argument geo-value. The interiors of both geo entities must intersect and the geo data must not exceed the bounds of the geo argument. Otherwise returns null
Arguments
- value: (required)
Any
- The geo value used to compare the input value to
Accepts
GeoJSON
GeoPoint
Geo
Object
String
Number
Examples
# Example (1)
geoWithin({ value: [ '10,10', '10,50', '50,50', '50,10', '10,10' ] })
{ type: 'Point', coordinates: [ 20, 20 ] }
{ type: 'Point', coordinates: [ 20, 20 ] }
# Example (2)
geoWithin({ value: [ '10,10', '10,50', '50,50', '50,10', '10,10' ] })
'20,20'
'20,20'
# Example (3)
geoWithin({ value: [ '10,10', '10,50', '50,50', '50,10', '10,10' ] })
{
type: 'Polygon',
coordinates: [ [ [ 20, 20 ], [ 20, 30 ], [ 30, 30 ], [ 30, 20 ], [ 20, 20 ] ] ]
}
{
type: 'Polygon',
coordinates: [ [ [ 20, 20 ], [ 20, 30 ], [ 30, 30 ], [ 30, 20 ], [ 20, 20 ] ] ]
}
# Example (4)
geoWithin({
value: {
type: 'MultiPolygon',
coordinates: [
[
[ [ 10, 10 ], [ 10, 50 ], [ 50, 50 ], [ 50, 10 ], [ 10, 10 ] ]
],
[
[
[ -10, -10 ],
[ -10, -50 ],
[ -50, -50 ],
[ -50, -10 ],
[ -10, -10 ]
]
]
]
}
})
{
type: 'MultiPolygon',
coordinates: [
[ [ [ 10, 10 ], [ 10, 50 ], [ 50, 50 ], [ 50, 10 ], [ 10, 10 ] ] ],
[
[
[ -10, -10 ],
[ -10, -50 ],
[ -50, -50 ],
[ -50, -10 ],
[ -10, -10 ]
]
]
]
}
{
type: 'MultiPolygon',
coordinates: [
[ [ [ 10, 10 ], [ 10, 50 ], [ 50, 50 ], [ 50, 10 ], [ 10, 10 ] ] ],
[
[
[ -10, -10 ],
[ -10, -50 ],
[ -50, -50 ],
[ -50, -10 ],
[ -10, -10 ]
]
]
]
}
# Example (5)
geoWithin({
value: {
type: 'MultiPolygon',
coordinates: [
[
[ [ 10, 10 ], [ 10, 50 ], [ 50, 50 ], [ 50, 10 ], [ 10, 10 ] ]
],
[
[
[ -10, -10 ],
[ -10, -50 ],
[ -50, -50 ],
[ -50, -10 ],
[ -10, -10 ]
]
]
]
}
})
{
type: 'MultiPolygon',
coordinates: [
[ [ [ 10, 10 ], [ 10, 20 ], [ 20, 20 ], [ 20, 10 ], [ 10, 10 ] ] ],
[ [ [ 30, 30 ], [ 30, 40 ], [ 40, 40 ], [ 40, 30 ], [ 30, 30 ] ] ]
]
}
{
type: 'MultiPolygon',
coordinates: [
[ [ [ 10, 10 ], [ 10, 20 ], [ 20, 20 ], [ 20, 10 ], [ 10, 10 ] ] ],
[ [ [ 30, 30 ], [ 30, 40 ], [ 40, 40 ], [ 40, 30 ], [ 30, 30 ] ] ]
]
}
geoContainsPoint
Type: FIELD_VALIDATION
Returns the input if it contains the geo-point, otherwise returns null
Arguments
- point: (required)
Any
- The point used to see if it is within the input geo-shape. If the input geo-shape is a point, it checks if they are the same
Accepts
GeoJSON
Examples
# Example (1)
geoContainsPoint({ point: '15, 15' })
{
type: 'Polygon',
coordinates: [ [ [ 10, 10 ], [ 10, 50 ], [ 50, 50 ], [ 50, 10 ], [ 10, 10 ] ] ]
}
{
type: 'Polygon',
coordinates: [ [ [ 10, 10 ], [ 10, 50 ], [ 50, 50 ], [ 50, 10 ], [ 10, 10 ] ] ]
}
# Example (2)
geoContainsPoint({ point: '15, 15' })
{
type: 'MultiPolygon',
coordinates: [
[ [ [ 10, 10 ], [ 10, 50 ], [ 50, 50 ], [ 50, 10 ], [ 10, 10 ] ] ],
[
[
[ -10, -10 ],
[ -10, -50 ],
[ -50, -50 ],
[ -50, -10 ],
[ -10, -10 ]
]
]
]
}
{
type: 'MultiPolygon',
coordinates: [
[ [ [ 10, 10 ], [ 10, 50 ], [ 50, 50 ], [ 50, 10 ], [ 10, 10 ] ] ],
[
[
[ -10, -10 ],
[ -10, -50 ],
[ -50, -50 ],
[ -50, -10 ],
[ -10, -10 ]
]
]
]
}
# Example (3)
geoContainsPoint({ point: '15, 15' })
{
type: 'Polygon',
coordinates: [
[
[ -10, -10 ],
[ -10, -50 ],
[ -50, -50 ],
[ -50, -10 ],
[ -10, -10 ]
],
[
[ -20, -20 ],
[ -20, -40 ],
[ -40, -40 ],
[ -40, -20 ],
[ -20, -20 ]
]
]
}
null
Point is within a polygon with holes
# Example (4)
geoContainsPoint({ point: '15, 15' })
{
type: 'Polygon',
coordinates: [
[ [ 10, 10 ], [ 10, 50 ], [ 50, 50 ], [ 50, 10 ], [ 10, 10 ] ],
[ [ 20, 20 ], [ 20, 40 ], [ 40, 40 ], [ 40, 20 ], [ 20, 20 ] ]
]
}
{
type: 'Polygon',
coordinates: [
[ [ 10, 10 ], [ 10, 50 ], [ 50, 50 ], [ 50, 10 ], [ 10, 10 ] ],
[ [ 20, 20 ], [ 20, 40 ], [ 40, 40 ], [ 40, 20 ], [ 20, 20 ] ]
]
}
Point can match against a geo-shape point
# Example (5)
geoContainsPoint({ point: '15, 15' })
{ type: 'Point', coordinates: [ 15, 15 ] }
{ type: 'Point', coordinates: [ 15, 15 ] }
inGeoBoundingBox
Type: FIELD_VALIDATION
Aliases: geoBox
Returns the input if it is within the geo bounding box, otherwise returns null
Arguments
-
top_left: (required)
Any
- The top-left geo-point used to construct the geo bounding box, must be a valid geo-point input -
bottom_right: (required)
Any
- The bottom_right geo-point used to construct the geo bounding box, must be a valid geo-point input
Accepts
GeoJSON
GeoPoint
Geo
Object
String
Number
Examples
# Example (1)
inGeoBoundingBox({
top_left: '33.906320,-112.758421',
bottom_right: '32.813646,-111.058902'
})
'33.2,-112.3'
'33.2,-112.3'
# Example (2)
inGeoBoundingBox({
top_left: '33.906320,-112.758421',
bottom_right: '32.813646,-111.058902'
})
'43,-132'
null
# Example (3)
inGeoBoundingBox({
top_left: '33.906320,-112.758421',
bottom_right: '32.813646,-111.058902'
})
{ type: 'Point', coordinates: [ -112, 33 ] }
{ type: 'Point', coordinates: [ -112, 33 ] }
isGeoJSON
Type: FIELD_VALIDATION
Returns the input if it is a GeoJSON object, otherwise returns null
Accepts
GeoJSON
Object
Examples
# Example (1)
isGeoJSON()
'60,40'
null
# Example (2)
isGeoJSON()
{ lat: 60, lon: 40 }
null
# Example (3)
isGeoJSON()
{ type: 'Point', coordinates: [ 12, 12 ] }
{ type: 'Point', coordinates: [ 12, 12 ] }
# Example (4)
isGeoJSON()
{
type: 'Polygon',
coordinates: [ [ [ 0, 0 ], [ 0, 15 ], [ 15, 15 ], [ 15, 0 ], [ 0, 0 ] ] ]
}
{
type: 'Polygon',
coordinates: [ [ [ 0, 0 ], [ 0, 15 ], [ 15, 15 ], [ 15, 0 ], [ 0, 0 ] ] ]
}
# Example (5)
isGeoJSON()
{
type: 'MultiPolygon',
coordinates: [
[ [ [ 10, 10 ], [ 10, 50 ], [ 50, 50 ], [ 50, 10 ], [ 10, 10 ] ] ],
[
[
[ -10, -10 ],
[ -10, -50 ],
[ -50, -50 ],
[ -50, -10 ],
[ -10, -10 ]
]
]
]
}
{
type: 'MultiPolygon',
coordinates: [
[ [ [ 10, 10 ], [ 10, 50 ], [ 50, 50 ], [ 50, 10 ], [ 10, 10 ] ] ],
[
[
[ -10, -10 ],
[ -10, -50 ],
[ -50, -50 ],
[ -50, -10 ],
[ -10, -10 ]
]
]
]
}
isGeoPoint
Type: FIELD_VALIDATION
Returns the input if it is parsable to a geo-point, otherwise returns null
Examples
# Example (1)
isGeoPoint()
'60,40'
'60,40'
# Example (2)
isGeoPoint()
[ 60, 40 ]
[ 60, 40 ]
# Example (3)
isGeoPoint()
{ lat: 60, lon: 40 }
{ lat: 60, lon: 40 }
# Example (4)
isGeoPoint()
{ latitude: 60, longitude: 40 }
{ latitude: 60, longitude: 40 }
# Example (5)
isGeoPoint()
'something'
null
isGeoShapeMultiPolygon
Type: FIELD_VALIDATION
Returns the input if it is a valid geo-json multi-polygon, otherwise returns null
Accepts
GeoJSON
Object
Examples
# Example (1)
isGeoShapeMultiPolygon()
{ type: 'Point', coordinates: [ 12, 12 ] }
null
# Example (2)
isGeoShapeMultiPolygon()
{
type: 'Polygon',
coordinates: [ [ [ 10, 10 ], [ 10, 50 ], [ 50, 50 ], [ 50, 10 ], [ 10, 10 ] ] ]
}
null
# Example (3)
isGeoShapeMultiPolygon()
{
type: 'MultiPolygon',
coordinates: [
[ [ [ 10, 10 ], [ 10, 50 ], [ 50, 50 ], [ 50, 10 ], [ 10, 10 ] ] ],
[
[
[ -10, -10 ],
[ -10, -50 ],
[ -50, -50 ],
[ -50, -10 ],
[ -10, -10 ]
]
]
]
}
{
type: 'MultiPolygon',
coordinates: [
[ [ [ 10, 10 ], [ 10, 50 ], [ 50, 50 ], [ 50, 10 ], [ 10, 10 ] ] ],
[
[
[ -10, -10 ],
[ -10, -50 ],
[ -50, -50 ],
[ -50, -10 ],
[ -10, -10 ]
]
]
]
}
isGeoShapePoint
Type: FIELD_VALIDATION
Returns the input if it is a valid geo-json point, otherwise returns null
Accepts
GeoJSON
Object
Examples
# Example (1)
isGeoShapePoint()
{ type: 'Point', coordinates: [ 12, 12 ] }
{ type: 'Point', coordinates: [ 12, 12 ] }
# Example (2)
isGeoShapePoint()
{
type: 'Polygon',
coordinates: [ [ [ 10, 10 ], [ 10, 50 ], [ 50, 50 ], [ 50, 10 ], [ 10, 10 ] ] ]
}
null
# Example (3)
isGeoShapePoint()
{
type: 'MultiPolygon',
coordinates: [
[ [ [ 10, 10 ], [ 10, 50 ], [ 50, 50 ], [ 50, 10 ], [ 10, 10 ] ] ],
[
[
[ -10, -10 ],
[ -10, -50 ],
[ -50, -50 ],
[ -50, -10 ],
[ -10, -10 ]
]
]
]
}
null
isGeoShapePolygon
Type: FIELD_VALIDATION
Return the input if it is a valid geo-json polygon, otherwise returns null
Accepts
GeoJSON
Object
Examples
# Example (1)
isGeoShapePolygon()
{ type: 'Point', coordinates: [ 12, 12 ] }
null
# Example (2)
isGeoShapePolygon()
{
type: 'Polygon',
coordinates: [ [ [ 10, 10 ], [ 10, 50 ], [ 50, 50 ], [ 50, 10 ], [ 10, 10 ] ] ]
}
{
type: 'Polygon',
coordinates: [ [ [ 10, 10 ], [ 10, 50 ], [ 50, 50 ], [ 50, 10 ], [ 10, 10 ] ] ]
}
# Example (3)
isGeoShapePolygon()
{
type: 'MultiPolygon',
coordinates: [
[ [ [ 10, 10 ], [ 10, 50 ], [ 50, 50 ], [ 50, 10 ], [ 10, 10 ] ] ],
[
[
[ -10, -10 ],
[ -10, -50 ],
[ -50, -50 ],
[ -50, -10 ],
[ -10, -10 ]
]
]
]
}
null
toGeoJSON
Type: FIELD_TRANSFORM
Converts a geo-point or a list of geo-points to geoJSON. Only supports geoJSON points or simple polygons, there is currently no support for multi-polygons or polygons/ multipolygons with holes
Accepts
String
Object
GeoPoint
Geo
Number
GeoJSON
Examples
# Example (1)
toGeoJSON()
'60,40'
{ type: 'Point', coordinates: [ 40, 60 ] }
# Example (2)
toGeoJSON()
[ '10,10', '10,50', '50,50', '50,10', '10,10' ]
{
type: 'Polygon',
coordinates: [ [ [ 10, 10 ], [ 50, 10 ], [ 50, 50 ], [ 10, 50 ], [ 10, 10 ] ] ]
}
# Example (3)
toGeoJSON()
{
type: 'MultiPolygon',
coordinates: [
[ [ [ 10, 10 ], [ 10, 50 ], [ 50, 50 ], [ 50, 10 ], [ 10, 10 ] ] ],
[
[
[ -10, -10 ],
[ -10, -50 ],
[ -50, -50 ],
[ -50, -10 ],
[ -10, -10 ]
]
]
]
}
{
type: 'MultiPolygon',
coordinates: [
[ [ [ 10, 10 ], [ 10, 50 ], [ 50, 50 ], [ 50, 10 ], [ 10, 10 ] ] ],
[
[
[ -10, -10 ],
[ -10, -50 ],
[ -50, -50 ],
[ -50, -10 ],
[ -10, -10 ]
]
]
]
}
toGeoPoint
Type: FIELD_TRANSFORM
Converts the input to a geo-point
Accepts
String
Object
GeoPoint
Geo
Number
Float
Examples
# Example (1)
toGeoPoint()
'60,40'
{ lon: 40, lat: 60 }
# Example (2)
toGeoPoint()
{ latitude: 40, longitude: 60 }
{ lon: 60, lat: 40 }
# Example (3)
toGeoPoint()
[ 50, 60 ]
{ lon: 50, lat: 60 }
# Example (4)
toGeoPoint()
'not an geo point'
CATEGORY: JSON
cast
Type: FIELD_TRANSFORM
Converts the field to another type, this is also useful changing the metadata of field
Arguments
-
type: (required)
String
- The type of field, defaults to Any, you may need to specify the type for better execution optimization -
array:
Boolean
- Indicates whether the field is an array -
description:
Text
- Set the description for the field -
locale:
String
- Specify the locale for the field (only compatible with some field types). Must be a BCP 47 Language Tag -
indexed:
Boolean
- Specifies whether the field is indexed in elasticsearch (Only type Object currently support this) -
format:
String
- The format for the field. Currently only supported by Date fields -
is_primary_date:
Boolean
- Used to denote naming of timeseries indices, and if any search/join queries off of this field should use a date searching algorithm -
time_resolution:
String
- Indicates whether the data has second or millisecond resolutions used with theis_primary_date
-
child_config:
Object
- If parsing an object, you can specify the DataTypeFields of the key/values of the object. This is an object whose keys are the name of the fields, whose value is an object with all of the other properties listed above (ie type, array, locale, format but not child_config)
Examples
# Example (1)
cast({ type: 'Integer' })
'21.223'
21
# Example (2)
cast({ type: 'Integer', array: true })
'21.223'
[ 21 ]
# Example (3)
cast({ type: 'Object', child_config: { foo: { type: 'Integer' } } })
{ foo: '21.23' }
{ foo: 21 }
parseJSON
Type: FIELD_TRANSFORM
Parses a JSON string and returns the value or object according to the arg options
Accepts
String
setDefault
Type: FIELD_TRANSFORM
Replaces missing values in a column with a constant value
Arguments
- value: (required)
Any
- The default value to use
Examples
# Example (1)
setDefault({ value: 'example' })
null
'example'
# Example (2)
setDefault({ value: 'example' })
null
[ 'example' ]
toJSON
Type: FIELD_TRANSFORM
Converts whole input to JSON format
Examples
# Example (1)
toJSON()
278218429446951548637196401n
'278218429446951548637196400'
# Example (2)
toJSON()
false
'false'
# Example (3)
toJSON()
{ some: 1234 }
'{"some":1234}'
# Example (4)
toJSON()
{ bigNum: 278218429446951548637196401n }
'{"bigNum":"278218429446951548637196400"}'
CATEGORY: Date
addToDate
Type: FIELD_TRANSFORM
Returns the input date added to a date expression or a specific number of years, months, weeks, days, hours, minutes, seconds, or milliseconds
Arguments
-
expr:
String
- The date math expression used to add to the input date. For example,1h
or1h+2m
-
years:
Integer
- The number of years to add to the date. This cannot be specified with expr -
months:
Integer
- The number of months to add to the date. This cannot be specified with expr -
weeks:
Integer
- The number of weeks to add to the date. This cannot be specified with expr -
days:
Integer
- The number of days to add to the date. This cannot be specified with expr -
hours:
Integer
- The number of hours to add to the date. This cannot be specified with expr -
minutes:
Integer
- The number of minutes to add to the date. This cannot be specified with expr -
seconds:
Integer
- The number of seconds to add to the date. This cannot be specified with expr -
milliseconds:
Integer
- The number of milliseconds to add to the date. This cannot be specified with expr
Accepts
Date
String
Number
Examples
# Example (1)
addToDate({ expr: '10h+2m' })
'2019-10-22T22:00:00.000Z'
'2019-10-23T08:02:00.000Z'
# Example (2)
addToDate({ months: 1, minutes: 2 })
'2019-10-22T22:00:00.000Z'
'2019-11-22T22:02:00.000Z'
# Example (3)
addToDate()
'2019-10-22T22:00:00.000Z'
Throws:
Expected an expr or years, months, weeks, days, hours, minutes, seconds or milliseconds
# Example (4)
addToDate({ expr: '1hr', months: 10 })
'2019-10-22T22:00:00.000Z'
Throws:
Invalid use of months with expr parameter
formatDate
Type: FIELD_TRANSFORM
Converts a date value to a formatted date string. Can specify the format with args to format the output value
Arguments
- format:
String
- When the value is a string, this indicates the date string format. See https://date-fns.org/v2.16.1/docs/parse for more info. Default: iso_8601 for strings and epoch_millis for numbers
Accepts
Date
String
Number
Examples
# Example (1)
formatDate({ format: 'yyyy-MM-dd' })
'2019-10-22T00:00:00.000Z'
'2019-10-22'
# Example (2)
formatDate()
102390933
'1970-01-02T04:26:30.933Z'
# Example (3)
formatDate({ format: 'milliseconds' })
'1973-03-31T01:55:33.000Z'
102390933000
# Example (4)
formatDate()
'2001-01-01T01:00:00.000Z'
'2001-01-01T01:00:00.000Z'
getDate
Type: FIELD_TRANSFORM
Returns the day of the month of the input date in UTC Time
Accepts
Date
String
Number
Examples
# Example (1)
getDate()
'2021-05-11T10:12:41.091Z'
11
# Example (2)
getDate()
2021-05-16T10:59:19.091Z
16
# Example (3)
getDate()
'05/22/2021 EST'
22
# Example (4)
getDate()
1510123223231
8
getHours
Type: FIELD_TRANSFORM
Returns the hours of the input date in UTC Time
Accepts
Date
String
Number
Examples
# Example (1)
getHours()
'2021-05-10T10:12:41.091Z'
10
# Example (2)
getHours()
2021-05-10T10:59:19.091Z
10
# Example (3)
getHours()
'05/22/2021 EST'
5
# Example (4)
getHours()
17154123223231
2
getMilliseconds
Type: FIELD_TRANSFORM
Returns the milliseconds of the input date
Accepts
Date
String
Number
Examples
# Example (1)
getMilliseconds()
'2021-05-10T10:00:01.091Z'
91
# Example (2)
getMilliseconds()
2021-05-10T10:00:01.091Z
91
# Example (3)
getMilliseconds()
1715472000231
231
getMinutes
Type: FIELD_TRANSFORM
Returns the minutes of the input date in UTC time
Accepts
Date
String
Number
Examples
# Example (1)
getMinutes()
'2021-05-10T10:12:41.091Z'
12
# Example (2)
getMinutes()
2021-05-10T10:59:19.091Z
59
# Example (3)
getMinutes()
1715472323231
5
getMonth
Type: FIELD_TRANSFORM
Returns the month of the input date in UTC Time
Accepts
Date
String
Number
Examples
# Example (1)
getMonth()
'2021-05-11T10:12:41.091Z'
5
# Example (2)
getMonth()
2021-05-16T10:59:19.091Z
5
# Example (3)
getMonth()
'05/22/2021 EST'
5
# Example (4)
getMonth()
1510123223231
11
getSeconds
Type: FIELD_TRANSFORM
Returns the seconds of the input date
Accepts
Date
String
Number
Examples
# Example (1)
getSeconds()
'2021-05-10T10:00:41.091Z'
41
# Example (2)
getSeconds()
2021-05-10T10:00:19.091Z
19
# Example (3)
getSeconds()
1715472323231
23
getTimeBetween
Type: FIELD_TRANSFORM
Returns the time duration between the input value and start or end arg. Can also select the interval and format with the args interval option
Arguments
-
start:
Date
- Start time of time range, if start is after the input it will return a negative number -
end:
Date
- End time of time range, if end is before the input it will return a negative number -
interval: (required)
String
- The interval of the return value. Accepts milliseconds, seconds, minutes, hours, days, calendarDays, businessDays, weeks, calendarWeeks, months, calendarMonths, quarters, calendarQuarters, years, calendarYears, calendarISOWeekYears and ISOWeekYears or use ISO8601 to get the return value in ISO-8601 duration format, see https://www.digi.com/resources/documentation/digidocs/90001437-13/reference/r_iso_8601_duration_format.htm
Accepts
Date
String
Number
Examples
# Example (1)
getTimeBetween({ start: '2021-05-10T10:00:00.000Z', interval: 'milliseconds' })
2021-05-10T10:00:01.000Z
1000
# Example (2)
getTimeBetween({ end: '2021-05-10T10:00:00.000Z', interval: 'days' })
'2021-05-09T10:00:00.000Z'
1
# Example (3)
getTimeBetween({ end: 1620764441001, interval: 'seconds' })
1620764440001
1
# Example (4)
getTimeBetween({ end: '2023-01-09T18:19:23.132Z', interval: 'ISO8601' })
'2021-05-10T10:00:00.000Z'
'P1Y7M30DT8H19M23S'
getTimezoneOffset
Type: FIELD_TRANSFORM
Given a date and timezone, it will return the offset from UTC in minutes. This is more accurate than timezoneToOffset as it can better account for daylight saving time
Arguments
- timezone: (required)
String
- Must be a valid IANA time zone name
Accepts
String
Number
Date
Examples
# Example (1)
getTimezoneOffset({ timezone: 'Africa/Accra' })
2021-05-20T15:13:52.131Z
0
# Example (2)
getTimezoneOffset({ timezone: 'America/Anchorage' })
2021-05-20T15:13:52.131Z
-480
# Example (3)
getTimezoneOffset({ timezone: 'America/Aruba' })
2021-05-20T15:13:52.131Z
-240
# Example (4)
getTimezoneOffset({ timezone: 'Asia/Istanbul' })
2021-05-20T15:13:52.131Z
180
# Example (5)
getTimezoneOffset({ timezone: 'Australia/Canberra' })
2021-05-20T15:13:52.131Z
600
getYear
Type: FIELD_TRANSFORM
Returns the year of the input date in UTC Time
Accepts
Date
String
Number
Examples
# Example (1)
getYear()
'2021-05-11T10:12:41.091Z'
2021
# Example (2)
getYear()
2021-05-16T10:59:19.091Z
2021
# Example (3)
getYear()
'05/22/2021 EST'
2021
# Example (4)
getYear()
1510123223231
2017
lookupTimezone
Type: FIELD_TRANSFORM
Returns the timezone of a geo point's location
Accepts
String
Object
GeoPoint
Geo
Number
Float
Examples
# Example (1)
lookupTimezone()
'33.385765, -111.891167'
'America/Phoenix'
In ocean outside Morocco
# Example (2)
lookupTimezone()
'30.00123,-12.233'
'Etc/GMT+1'
# Example (3)
lookupTimezone()
[ 30.00123, 12.233 ]
'Africa/Khartoum'
# Example (4)
lookupTimezone()
{ lat: 48.86168702148502, lon: 2.3366209636711 }
'Europe/Paris'
setDate
Type: FIELD_TRANSFORM
Returns the input date with the day of the month set to the args value
Arguments
- value: (required)
Number
- Value to set day of the month to, must be between 1 and 31
Accepts
String
Date
Number
Examples
# Example (1)
setDate({ value: 12 })
'2021-05-14T20:45:30.000Z'
'2021-05-12T20:45:30.000Z'
# Example (2)
setDate({ value: 22 })
2021-05-14T20:45:30.091Z
'2021-05-22T20:45:30.091Z'
# Example (3)
setDate({ value: 1 })
1715472000000
'2024-05-01T00:00:00.000Z'
setHours
Type: FIELD_TRANSFORM
Returns the input date with the hours set to the args value
Arguments
- value: (required)
Number
- Value to set hours to, must be between 0 and 23
Accepts
String
Date
Number
Examples
# Example (1)
setHours({ value: 12 })
'2021-05-14T20:45:30.000Z'
'2021-05-14T12:45:30.000Z'
# Example (2)
setHours({ value: 22 })
2021-05-14T20:45:30.091Z
'2021-05-14T22:45:30.091Z'
# Example (3)
setHours({ value: 1 })
1715472000000
'2024-05-12T01:00:00.000Z'
setMilliseconds
Type: FIELD_TRANSFORM
Returns the input date with the milliseconds set to the args value
Arguments
- value: (required)
Number
- Value to set milliseconds to, must be between 0 and 999
Accepts
String
Date
Number
Examples
# Example (1)
setMilliseconds({ value: 392 })
'2021-05-14T20:45:30.000Z'
'2021-05-14T20:45:30.392Z'
# Example (2)
setMilliseconds({ value: 483 })
2021-05-14T20:45:30.091Z
'2021-05-14T20:45:30.483Z'
# Example (3)
setMilliseconds({ value: 1 })
1715472000000
'2024-05-12T00:00:00.001Z'
setMinutes
Type: FIELD_TRANSFORM
Returns the input date with the minutes set to the args value
Arguments
- value: (required)
Number
- Value to set minutes to, must be between 0 and 59
Accepts
String
Date
Number
Examples
# Example (1)
setMinutes({ value: 12 })
'2021-05-14T20:45:30.000Z'
'2021-05-14T20:12:30.000Z'
# Example (2)
setMinutes({ value: 22 })
2021-05-14T20:45:30.091Z
'2021-05-14T20:22:30.091Z'
# Example (3)
setMinutes({ value: 1 })
1715472000000
'2024-05-12T00:01:00.000Z'
setMonth
Type: FIELD_TRANSFORM
Returns the input date with the month set to the args value
Arguments
- value: (required)
Number
- Value to set value to, must be between 1 and 12
Accepts
String
Date
Number
Examples
# Example (1)
setMonth({ value: 12 })
'2021-05-14T20:45:30.000Z'
'2021-12-14T20:45:30.000Z'
# Example (2)
setMonth({ value: 2 })
2021-05-14T20:45:30.091Z
'2021-02-14T20:45:30.091Z'
# Example (3)
setMonth({ value: 1 })
1715472000000
'2024-01-12T00:00:00.000Z'
setSeconds
Type: FIELD_TRANSFORM
Returns the input date with the seconds set to the args value
Arguments
- value: (required)
Number
- Value to set seconds to, must be between 0 and 59
Accepts
String
Date
Number
Examples
# Example (1)
setSeconds({ value: 12 })
'2021-05-14T20:45:30.000Z'
'2021-05-14T20:45:12.000Z'
# Example (2)
setSeconds({ value: 22 })
2021-05-14T20:45:30.091Z
'2021-05-14T20:45:22.091Z'
# Example (3)
setSeconds({ value: 1 })
1715472000000
'2024-05-12T00:00:01.000Z'
setTimezone
Type: FIELD_TRANSFORM
Returns the input date with the timezone set to the args value
Arguments
- timezone: (required)
Any
- Value to set timezone to in minutes or timezone name. Offset must be between -1440 and 1440
Accepts
Date
String
Number
Examples
# Example (1)
setTimezone({ timezone: 420 })
'2021-05-14T20:45:30.000Z'
'2021-05-14T20:45:30.000+07:00'
# Example (2)
setTimezone({ timezone: 'America/Phoenix' })
'2021-05-14T20:45:30.000Z'
'2021-05-14T20:45:30.000-07:00'
# Example (3)
setTimezone({ timezone: 120 })
'2020-02-14T20:45:30.091Z'
'2020-02-14T20:45:30.091+02:00'
# Example (4)
setTimezone({ timezone: 'Europe/Paris' })
'2020-02-14T20:45:30.091Z'
'2020-02-14T20:45:30.091+02:00'
setYear
Type: FIELD_TRANSFORM
Returns the input date with the year set to the args value
Arguments
- value: (required)
Number
- Value to set year to, must be an integer
Accepts
String
Date
Number
Examples
# Example (1)
setYear({ value: 2024 })
'2021-05-14T20:45:30.000Z'
'2024-05-14T20:45:30.000Z'
# Example (2)
setYear({ value: 1984 })
2021-05-14T20:45:30.091Z
'1984-05-14T20:45:30.091Z'
# Example (3)
setYear({ value: 2023 })
[ 1621026000000, 420 ]
'2023-05-14T14:00:00.000Z'
# Example (4)
setYear({ value: 2001 })
1715472000000
'2001-05-12T00:00:00.000Z'
subtractFromDate
Type: FIELD_TRANSFORM
Returns the input date minus the date expression or a specific number of years, months, weeks, days, hours, minutes, seconds, or milliseconds
Arguments
-
expr:
String
- The date math expression used to subtract from the input date. For example,1h
or1h+2m
-
years:
Integer
- The number of years to subtract from the date. This cannot be specified with expr -
months:
Integer
- The number of months to subtract from the date. This cannot be specified with expr -
weeks:
Integer
- The number of weeks to subtract from the date. This cannot be specified with expr -
days:
Integer
- The number of days to subtract from the date. This cannot be specified with expr -
hours:
Integer
- The number of hours to subtract from the date. This cannot be specified with expr -
minutes:
Integer
- The number of minutes to subtract from the date. This cannot be specified with expr -
seconds:
Integer
- The number of seconds to subtract from the date. This cannot be specified with expr -
milliseconds:
Integer
- The number of milliseconds to subtract from the date. This cannot be specified with expr
Accepts
Date
Examples
# Example (1)
subtractFromDate({ expr: '10h+2m' })
'2019-10-22T22:00:00.000Z'
'2019-10-22T12:02:00.000Z'
# Example (2)
subtractFromDate({ months: 1, minutes: 2 })
'2019-10-22T22:00:00.000Z'
'2019-09-22T21:58:00.000Z'
# Example (3)
subtractFromDate()
'2019-10-22T22:00:00.000Z'
Throws:
Expected an expr or years, months, weeks, days, hours, minutes, seconds or milliseconds
# Example (4)
subtractFromDate({ expr: '1hr', months: 10 })
'2019-10-22T22:00:00.000Z'
Throws:
Invalid use of months with expr parameter
timezoneToOffset
Type: FIELD_TRANSFORM
Given a timezone, it will return the offset from UTC in minutes. This uses current server time as the reference for a date, so results may vary depending on daylight saving time adjustments
Accepts
String
Examples
# Example (1)
timezoneToOffset()
'America/Phoenix'
-420
toDailyDate
Type: FIELD_TRANSFORM
Converts a value to a daily ISO 8601 date segment
Accepts
String
Number
Date
Examples
# Example (1)
toDailyDate()
'2019-10-22T01:00:00.000Z'
'2019-10-22T00:00:00.000Z'
# Example (2)
toDailyDate()
[ 1571706000000, 60 ]
'2019-10-22T00:00:00.000Z'
toDate
Type: FIELD_TRANSFORM
Converts a value to a date value, specify a format to apply it to the input value
Arguments
- format:
String
- When the value is a string, this indicates the date string format. See https://date-fns.org/v2.16.1/docs/parse for more info. Default: iso_8601 for strings and epoch_millis for number
Accepts
String
Number
Date
Examples
# Example (1)
toDate({ format: 'yyyy-MM-dd' })
'2019-10-22'
'2019-10-22T00:00:00.000Z'
# Example (2)
toDate()
102390933
'1970-01-02T04:26:30.933Z'
# Example (3)
toDate({ format: 'seconds' })
102390933
'1973-03-31T01:55:33.000Z'
# Example (4)
toDate({ format: 'milliseconds' })
102390933000
'1973-03-31T01:55:33.000Z'
# Example (5)
toDate()
'2001-01-01T01:00:00.000Z'
'2001-01-01T01:00:00.000Z'
toHourlyDate
Type: FIELD_TRANSFORM
Converts a value to a hourly ISO 8601 date segment
Accepts
String
Number
Date
Examples
# Example (1)
toHourlyDate()
'2019-10-22T01:05:20.000Z'
'2019-10-22T01:00:00.000Z'
toMonthlyDate
Type: FIELD_TRANSFORM
Converts a value to a monthly ISO 8601 date segment
Accepts
String
Number
Date
Examples
# Example (1)
toMonthlyDate()
'2019-10-22T01:00:00.000Z'
'2019-10-01T00:00:00.000Z'
# Example (2)
toMonthlyDate()
[ 1571706000000, 120 ]
'2019-10-01T00:00:00.000Z'
toYearlyDate
Type: FIELD_TRANSFORM
Converts a value to a yearly ISO 8601 date segment
Accepts
String
Number
Date
Examples
# Example (1)
toYearlyDate()
'2019-10-22T01:00:00.000Z'
'2019-01-01T00:00:00.000Z'
isAfter
Type: FIELD_VALIDATION
Returns the input if it is after the arg date, otherwise returns null
Arguments
- date: (required)
Date
- Date to compare input to
Accepts
Date
String
Number
Examples
# Example (1)
isAfter({ date: '2021-05-09T10:00:00.000Z' })
'2021-05-10T10:00:00.000Z'
'2021-05-10T10:00:00.000Z'
# Example (2)
isAfter({ date: 1620554400000 })
'2021-05-10T10:00:00.000Z'
'2021-05-10T10:00:00.000Z'
# Example (3)
isAfter({ date: '2021-05-09T10:00:00.000Z' })
1620640800000
1620640800000
# Example (4)
isAfter({ date: '2021-05-10T10:00:00.000Z' })
'2021-05-09T10:00:00.000Z'
null
# Example (5)
isAfter({ date: [ 1620640800000, -420 ] })
'2021-05-10T10:00:00.000Z'
null
isBefore
Type: FIELD_VALIDATION
Returns the input if it is before the arg date, otherwise returns null
Arguments
- date: (required)
Date
- Date to compare input to
Accepts
Date
String
Number
Examples
# Example (1)
isBefore({ date: '2021-05-10T10:00:00.000Z' })
'2021-05-09T10:00:00.000Z'
'2021-05-09T10:00:00.000Z'
# Example (2)
isBefore({ date: '2021-05-10T10:00:00.000Z' })
1620554400000
1620554400000
# Example (3)
isBefore({ date: 1620640800000 })
'2021-05-09T10:00:00.000Z'
'2021-05-09T10:00:00.000Z'
# Example (4)
isBefore({ date: '2021-05-10T10:00:00.000Z' })
'2021-05-11T10:00:00.000Z'
null
isBetween
Type: FIELD_VALIDATION
Returns the input if it is between the args start and end dates, otherwise returns null
Arguments
-
start: (required)
Date
- Start date of time range -
end: (required)
Date
- End date of time range
Accepts
Date
String
Number
Examples
# Example (1)
isBetween({ start: '2021-05-09T10:00:00.001Z', end: '2021-05-11T10:00:00.001Z' })
'2021-05-10T10:00:00.001Z'
'2021-05-10T10:00:00.001Z'
# Example (2)
isBetween({ start: 1620554400000, end: 1620640800000 })
1620554401000
1620554401000
# Example (3)
isBetween({ start: '2021-05-09T10:00:00.001Z', end: '2021-05-11T10:00:00.001Z' })
'2021-05-07T10:00:00.000Z'
null
# Example (4)
isBetween({ start: '2021-05-09T10:00:00.001Z', end: '2021-05-11T10:00:00.001Z' })
'2021-05-15T10:00:00.000Z'
null
isDate
Type: FIELD_VALIDATION
Returns the input if it is a valid date, if format is provided the format will be applied to the validation
Arguments
- format:
String
- When the value is a string, this indicates the date string format. See https://date-fns.org/v2.16.1/docs/parse for more info. Default: iso_8601 for strings and epoch_millis for number
Accepts
Date
String
Number
Examples
# Example (1)
isDate({ format: 'yyyy-MM-dd' })
'2019-10-22'
'2019-10-22'
# Example (2)
isDate({ format: 'yyyy-MM-dd' })
'10-22-2019'
null
# Example (3)
isDate({ format: 'epoch' })
102390933
102390933
# Example (4)
isDate()
'2001-01-01T01:00:00.000Z'
'2001-01-01T01:00:00.000Z'
isEpoch
Type: FIELD_VALIDATION
Aliases: isUnixTime
Returns the input if it is a valid epoch timestamp. Accuracy is not guaranteed since any number could be a valid epoch timestamp
Arguments
- allowBefore1970:
Boolean
- Set to false to disable allowing negative values
Accepts
Number
Examples
# Example (1)
isEpoch()
'2019-10-22'
null
# Example (2)
isEpoch()
102390933
102390933
# Example (3)
isEpoch()
'2001-01-01T01:00:00.000Z'
null
# Example (4)
isEpoch({ allowBefore1970: false })
-102390933
null
# Example (5)
isEpoch()
-102390933
-102390933
isEpochMillis
Type: FIELD_VALIDATION
Returns the input if it is a valid epoch timestamp (in milliseconds). Accuracy is not guaranteed since any number could be a valid epoch timestamp
Arguments
- allowBefore1970:
Boolean
- Set to false to disable allowing negative values
Accepts
Number
Examples
# Example (1)
isEpochMillis()
'2019-10-22'
null
# Example (2)
isEpochMillis()
102390933
102390933
# Example (3)
isEpochMillis()
'2001-01-01T01:00:00.000Z'
null
# Example (4)
isEpochMillis({ allowBefore1970: false })
-102390933
null
# Example (5)
isEpochMillis()
-102390933
-102390933
isFriday
Type: FIELD_VALIDATION
Returns the given date if it is on a Friday, otherwise returns null
Accepts
String
Date
Number
Examples
# Example (1)
isFriday()
'2021-05-14T10:00:00.000Z'
'2021-05-14T10:00:00.000Z'
# Example (2)
isFriday()
[ 1620986400000, -620 ]
'2021-05-14T10:00:00.000-10:20'
# Example (3)
isFriday()
'2021-05-09T10:00:00.000Z'
null
isFuture
Type: FIELD_VALIDATION
Returns the the input if it is in the future, otherwise returns null
Accepts
String
Date
Number
Examples
# Example (1)
isFuture()
'2021-05-10T10:00:00.000Z'
null
# Example (2)
isFuture()
'2121-05-09T10:00:00.000Z'
'2121-05-09T10:00:00.000Z'
isISO8601
Type: FIELD_VALIDATION
Returns the input if it is a valid ISO-8601 date, otherwise returns null
Accepts
Date
String
Number
Examples
# Example (1)
isISO8601()
102390933
null
# Example (2)
isISO8601()
'2001-01-01T01:00:00.000Z'
'2001-01-01T01:00:00.000Z'
# Example (3)
isISO8601()
102390933
null
isLeapYear
Type: FIELD_VALIDATION
Returns the the input if it is in a leap year, otherwise returns null
Accepts
String
Date
Number
Examples
# Example (1)
isLeapYear()
'2020-05-10T10:00:00.000Z'
'2020-05-10T10:00:00.000Z'
# Example (2)
isLeapYear()
[ 1589104800000, 60 ]
'2020-05-10T10:00:00.000+01:00'
# Example (3)
isLeapYear()
'2021-05-10T10:00:00.000Z'
null
isMonday
Type: FIELD_VALIDATION
Returns the the input if it is on a Monday
Accepts
String
Date
Number
Examples
# Example (1)
isMonday()
'2021-05-10T10:00:00.000Z'
'2021-05-10T10:00:00.000Z'
# Example (2)
isMonday()
'2021-05-09T10:00:00.000Z'
null
isPast
Type: FIELD_VALIDATION
Returns the input if it is in the past, otherwise returns null
Accepts
String
Date
Number
Examples
# Example (1)
isPast()
'2021-05-10T10:00:00.000Z'
'2021-05-10T10:00:00.000Z'
# Example (2)
isPast()
'2121-05-09T10:00:00.000Z'
null
isSaturday
Type: FIELD_VALIDATION
Returns the input if it is on a Saturday, otherwise returns null
Accepts
String
Date
Number
Examples
# Example (1)
isSaturday()
'2021-05-08T10:00:00.000Z'
'2021-05-08T10:00:00.000Z'
# Example (2)
isSaturday()
'2021-05-09T10:00:00.000Z'
null
isSunday
Type: FIELD_VALIDATION
Returns the input if it is on a Sunday, otherwise returns null
Accepts
String
Date
Number
Examples
# Example (1)
isSunday()
'2021-05-09T10:00:00.000Z'
'2021-05-09T10:00:00.000Z'
# Example (2)
isSunday()
1620554400000
1620554400000
isThursday
Type: FIELD_VALIDATION
Returns the input if it is on a Thursday, otherwise returns null
Accepts
String
Date
Number
Examples
# Example (1)
isThursday()
'2021-05-13T10:00:00.000Z'
'2021-05-13T10:00:00.000Z'
# Example (2)
isThursday()
'2021-05-09T10:00:00.000Z'
null
isToday
Type: FIELD_VALIDATION
Returns the input if it is on the same day (utc-time), otherwise returns null
Accepts
String
Date
Number
Examples
This input is created at execution time
# Example (1)
isToday()
'2021-10-28T22:06:00.484Z'
'2021-10-28T22:06:00.484Z'
# Example (2)
isToday()
'2020-05-09T10:00:00.000Z'
null
isTomorrow
Type: FIELD_VALIDATION
Returns the input if it is on the next day (utc-time), otherwise returns null
Accepts
String
Date
Number
Examples
Represents current time
# Example (1)
isTomorrow()
'2021-10-28T22:06:00.485Z'
null
Represents day after current time
# Example (2)
isTomorrow()
'2021-10-29T22:06:00.485Z'
'2021-10-29T22:06:00.485Z'
isTuesday
Type: FIELD_VALIDATION
Returns the input if it is on a Tuesday, otherwise returns null
Accepts
String
Date
Number
Examples
# Example (1)
isTuesday()
'2021-05-11T10:00:00.000Z'
'2021-05-11T10:00:00.000Z'
# Example (2)
isTuesday()
'2021-05-09T10:00:00.000Z'
null
isWednesday
Type: FIELD_VALIDATION
Returns the input if it is on a Wednesday, otherwise returns null
Accepts
String
Date
Number
Examples
# Example (1)
isWednesday()
'2021-05-12T10:00:00.000Z'
'2021-05-12T10:00:00.000Z'
# Example (2)
isWednesday()
'2021-05-09T10:00:00.000Z'
null
isWeekday
Type: FIELD_VALIDATION
Returns the input if it is on a Weekday (Monday-Friday), otherwise returns null
Accepts
String
Date
Number
Examples
# Example (1)
isWeekday()
'2021-05-12T10:00:00.000Z'
'2021-05-12T10:00:00.000Z'
# Example (2)
isWeekday()
'2021-05-13T10:00:00.000Z'
'2021-05-13T10:00:00.000Z'
# Example (3)
isWeekday()
'2021-05-09T10:00:00.000Z'
null
# Example (4)
isWeekday()
'2021-05-08T10:00:00.000Z'
null
isWeekend
Type: FIELD_VALIDATION
Returns the input if it is on a Weekend (Saturday-Sunday), otherwise returns null
Accepts
String
Date
Number
Examples
# Example (1)
isWeekend()
'2021-05-12T10:00:00.000Z'
null
# Example (2)
isWeekend()
'2021-05-13T10:00:00.000Z'
null
# Example (3)
isWeekend()
'2021-05-09T10:00:00.000Z'
'2021-05-09T10:00:00.000Z'
# Example (4)
isWeekend()
'2021-05-08T10:00:00.000Z'
'2021-05-08T10:00:00.000Z'
isYesterday
Type: FIELD_VALIDATION
Returns the input if it is on the day before (utc-time), otherwise returns null
Accepts
String
Date
Number
Examples
Represents current time
# Example (1)
isYesterday()
'2021-10-28T22:06:00.488Z'
null
Represents day before current time
# Example (2)
isYesterday()
'2021-10-27T22:06:00.488Z'
'2021-10-27T22:06:00.488Z'
CATEGORY: Numeric
abs
Type: FIELD_TRANSFORM
Returns the absolute value of a number
Accepts
Number
Examples
# Example (1)
abs()
-1
1
acos
Type: FIELD_TRANSFORM
Returns a numeric value between 0 and π radians for x between -1 and 1
Accepts
Number
Examples
# Example (1)
acos()
-1
3.141592653589793
acosh
Type: FIELD_TRANSFORM
Returns the hyperbolic arc-cosine of a given number. If given the number is less than 1, returns null
Accepts
Number
Examples
# Example (1)
acosh()
1
0
Since this function doesn't work with numbers <=0, null will be returned
# Example (2)
acosh()
0
null
add
Type: FIELD_TRANSFORM
Returns the sum of the input and the args value
Arguments
- value: (required)
Number
- Value to add to the input
Accepts
Number
Examples
# Example (1)
add({ value: 1 })
10
11
# Example (2)
add({ value: 5 })
10
15
# Example (3)
add({ value: -5 })
10
5
# Example (4)
add({ value: 12 })
12
24
addValues
Type: FIELD_TRANSFORM
Adds the values with a given field, this requires an array to function correctly
Accepts
Number
Examples
# Example (1)
addValues()
[ 100, 10 ]
110
# Example (2)
addValues()
[ 10 ]
10
# Example (3)
addValues()
[ 10, 100000, 2 ]
100012
# Example (4)
addValues()
[ [ 10, null ], 100000, [ 2 ], null ]
100012
# Example (5)
addValues()
2
2
asin
Type: FIELD_TRANSFORM
Returns the arcsine (in radians) of the given number if it's between -1 and 1
Accepts
Number
Examples
# Example (1)
asin()
1
1.5707963267948966
asinh
Type: FIELD_TRANSFORM
Returns the hyperbolic arcsine of the given number
Accepts
Number
Examples
# Example (1)
asinh()
1
0.881373587019543
atan
Type: FIELD_TRANSFORM
Returns the arctangent (in radians) of the given number
Accepts
Number
Examples
# Example (1)
atan()
1
0.7853981633974483
atan2
Type: FIELD_TRANSFORM
Returns the angle in the plane (in radians) between the positive x-axis and the ray from (0,0) to the point (x,y), for atan2(y,x)
Accepts
Number
Examples
# Example (1)
atan2()
[ 15, 90 ]
1.4056476493802699
# Example (2)
atan2()
[ 90, 15 ]
0.16514867741462683
# Example (3)
atan2()
[ -90, null ]
Throws:
Expected (x, y) coordinates, got [-90,null] (Array)
atanh
Type: FIELD_TRANSFORM
Returns the arctangent (in radians) of the given number
Accepts
Number
Examples
# Example (1)
atanh()
0.5
0.5493061443340548
Typically this would return -Infinity but that cannot be stored or serialized so null is returned
# Example (2)
atanh()
-1
null
cbrt
Type: FIELD_TRANSFORM
Returns the cube root of a number
Accepts
Number
Examples
# Example (1)
cbrt()
64
4
# Example (2)
cbrt()
1
1
ceil
Type: FIELD_TRANSFORM
Rounds a number up to the next largest integer
Accepts
Number
Examples
# Example (1)
ceil()
0.95
1
# Example (2)
ceil()
0.1
1
# Example (3)
ceil()
-7.004
-7
clz32
Type: FIELD_TRANSFORM
Returns the number of leading zero bits in the 32-bit binary representation of a number
Accepts
Number
Examples
# Example (1)
clz32()
1
31
# Example (2)
clz32()
1000
22
# Example (3)
clz32()
4
29
cos
Type: FIELD_TRANSFORM
Returns the cosine of the specified angle, which must be specified in radians
Accepts
Number
Examples
# Example (1)
cos()
0
1
# Example (2)
cos()
3.141592653589793
-1
# Example (3)
cos()
6.283185307179586
1
cosh
Type: FIELD_TRANSFORM
Returns the hyperbolic cosine of a number that can be expressed using the constant e
Accepts
Number
Examples
# Example (1)
cosh()
0
1
# Example (2)
cosh()
3.141592653589793
11.591953275521519
divide
Type: FIELD_TRANSFORM
Returns the quotient from the input divided by the args value
Arguments
- value: (required)
Number
- Value to divide into the input
Accepts
Number
Examples
# Example (1)
divide({ value: 5 })
10
2
# Example (2)
divide({ value: 1 })
10
10
# Example (3)
divide({ value: 2 })
10
5
divideValues
Type: FIELD_TRANSFORM
Divides the values with a given field, this requires an array to function correctly
Accepts
Number
Examples
# Example (1)
divideValues()
[ 100, 10 ]
10
# Example (2)
divideValues()
[ 10 ]
10
# Example (3)
divideValues()
[ 10, 100000, 2 ]
0.00005
# Example (4)
divideValues()
[ [ 10, null ], 100000, [ 2 ], null ]
0.00005
# Example (5)
divideValues()
2
2
# Example (6)
divideValues()
[ 0, 0 ]
NaN
# Example (7)
divideValues()
[ 100, 0 ]
Infinity
exp
Type: FIELD_TRANSFORM
Returns a number representing
e^x
, wheree
is Euler's number andx
is the argument
Accepts
Number
Examples
# Example (1)
exp()
0
1
# Example (2)
exp()
1
2.718281828459045
expm1
Type: FIELD_TRANSFORM
Returns a number representing
e^x - 1
, wheree
is Euler's number andx
is the argument
Accepts
Number
Examples
# Example (1)
expm1()
0
0
# Example (2)
expm1()
1
1.718281828459045
floor
Type: FIELD_TRANSFORM
Rounds a number down to the previous largest integer
Accepts
Number
Examples
# Example (1)
floor()
0.95
0
# Example (2)
floor()
0.1
0
# Example (3)
floor()
-7.004
-8
fround
Type: FIELD_TRANSFORM
Returns the nearest 32-bit single precision float representation of the given number
Accepts
Number
Examples
# Example (1)
fround()
5.5
5.5
# Example (2)
fround()
-5.05
-5.050000190734863
hypot
Type: FIELD_TRANSFORM
Returns the square root of the sum of squares of the given arguments. If at least one of the arguments cannot be converted to a number, null is returned
Accepts
Number
Examples
# Example (1)
hypot()
[ 3, 4 ]
5
# Example (2)
hypot()
[ 5, 12 ]
13
# Example (3)
hypot()
[ 3, 4, null, 5 ]
7.0710678118654755
# Example (4)
hypot()
null
null
log
Type: FIELD_TRANSFORM
Returns the natural logarithm (base e) of the given number. If the number is negative, null is returned
Accepts
Number
Examples
# Example (1)
log()
1
0
# Example (2)
log()
10
2.302585092994046
# Example (3)
log()
-1
null
log1p
Type: FIELD_TRANSFORM
Returns the natural logarithm (base e) of 1 plus the given number. If the number is less than -1, null is returned
Accepts
Number
Examples
# Example (1)
log1p()
1
0.6931471805599453
# Example (2)
log1p()
0
0
Typically this would return -Infinity but that cannot be stored or serialized so null is returned
# Example (3)
log1p()
-1
null
Typically this would return NaN but that cannot be stored or serialized so null is returned
# Example (4)
log1p()
-2
null
log2
Type: FIELD_TRANSFORM
Returns the base 2 logarithm of the given number. If the number is negative, null is returned
Accepts
Number
Examples
# Example (1)
log2()
2
1
Typically this would return -Infinity but that cannot be stored or serialized so null is returned
# Example (2)
log2()
0
null
# Example (3)
log2()
-2
null
log10
Type: FIELD_TRANSFORM
Returns the base 10 logarithm of the given number. If the number is negative, null is returned
Accepts
Number
Examples
# Example (1)
log10()
10
1
Typically this would return -Infinity but that cannot be stored or serialized so null is returned
# Example (2)
log10()
0
null
# Example (3)
log10()
-2
null
maxValues
Type: FIELD_TRANSFORM
Returns the maximum value in an array, this requires an array to function correctly
Accepts
Number
Examples
# Example (1)
maxValues()
[ 100, 10 ]
100
# Example (2)
maxValues()
[ 10 ]
10
# Example (3)
maxValues()
[ 10, 100000, 2 ]
100000
# Example (4)
maxValues()
[ [ 10, null ], 100000, [ 2 ], null ]
100000
# Example (5)
maxValues()
2
2
minValues
Type: FIELD_TRANSFORM
Returns the minimum value in an array, this requires an array to function correctly
Accepts
Number
Examples
# Example (1)
minValues()
[ 100, 10 ]
10
# Example (2)
minValues()
[ 10 ]
10
# Example (3)
minValues()
[ 10, 100000, 2 ]
2
# Example (4)
minValues()
[ [ 10, null ], 100000, [ 2 ], null ]
2
# Example (5)
minValues()
2
2
modulus
Type: FIELD_TRANSFORM
Aliases: mod
Returns the modulus from the input divided by the args value
Arguments
- value: (required)
Number
- Value to divide into the input
Accepts
Number
Examples
# Example (1)
modulus({ value: 2 })
10
0
# Example (2)
modulus({ value: 2 })
9
1
# Example (3)
modulus({ value: -5 })
10
0
# Example (4)
modulus({ value: 10 })
101
1
multiply
Type: FIELD_TRANSFORM
Returns the product of the input multiplied by the args value
Arguments
- value: (required)
Number
- Value to multiply the input by
Accepts
Number
Examples
# Example (1)
multiply({ value: 5 })
10
50
# Example (2)
multiply({ value: -2 })
10
-20
# Example (3)
multiply({ value: 2 })
10
20
multiplyValues
Type: FIELD_TRANSFORM
Multiplies the values with a given field, this requires an array to function correctly
Accepts
Number
Examples
# Example (1)
multiplyValues()
[ 100, 10 ]
1000
# Example (2)
multiplyValues()
[ 10 ]
10
# Example (3)
multiplyValues()
[ 10, 100000, 2 ]
2000000
# Example (4)
multiplyValues()
[ [ 10, null ], 100000, [ 2 ], null ]
2000000
# Example (5)
multiplyValues()
2
2
pow
Type: FIELD_TRANSFORM
Aliases: power
Returns a number representing the input value taken to the power of the value
Arguments
- value: (required)
Number
- The exponent used to raise the base
Accepts
Number