Skip to content

Commit aecc264

Browse files
khamidoumarkzegarelli
andauthored
Update docs on FQL builtins (#4374)
* Update builtins * fix absolute link * Apply Mark's suggestions Co-authored-by: markzegarelli <[email protected]> --------- Co-authored-by: markzegarelli <[email protected]>
1 parent 6aab389 commit aecc264

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/api/public-api/fql.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ redirect_from:
1010

1111
Destination Filter Reference documentation can be found in the [main Config API reference docs](https://reference.segmentapis.com/#6c12fbe8-9f84-4a6c-848e-76a2325cb3c5).
1212

13-
Filter Query Language ("FQL") is a simple language for filtering JSON objects used by the Transformations API to conditionally apply transformations. In the Transformations API, FQL statements evaluate to `true` or `false` based on the contents of each Segment event. If the statement evaluates to `true`, the transformation is applied, and if it is `false` the transformation is not applied.
13+
The Transformations API uses Filter Query Language (FQL) to filter JSON objects and conditionally apply transformations. You can use FQL statements to:
14+
- Apply filters that evaluate to `true` or `false` based on the contents of each Segment event. If the statement evaluates to `true`, the transformation is applied, and if it is `false` the transformation is not applied.
15+
- [Define new properties based on the result of an FQL statement](/docs/protocols/transform/#use-cases).
1416

1517
In addition to boolean and equality operators like `and` and `>=`, FQL has built-in functions that make it more powerful such as `contains( str, substr )` and `match( str, pattern )`.
1618

@@ -130,8 +132,15 @@ You can use parentheses to group subexpressions for more complex "and / or" logi
130132
| `contains( s string, sub string )` | `bool` | Returns `true` if string `s` contains string `sub`. |
131133
| `length( list or string )` | `number` | Returns the number of elements in a list or number of bytes (not necessarily characters) in a string. For example, `a` is 1 byte and`` is 3 bytes long. |
132134
| `lowercase( s string )` | `string` | Returns `s` with all uppercase characters replaced with their lowercase equivalent. |
135+
| `uppercase( s string )` | `string` | Returns `s` with all lowercase characters replaced with their uppercase equivalent. |
136+
| `snakecase( s string )` | `string` | Returns `s` with all space characters replaced by underscores. For example, `kebabcase("test string")` returns `test_string`. |
137+
| `kebabcase( s string )` | `string` | Returns `s` with all space characters replaced by dashes. For example, `kebabcase("test string")` returns `test-string`. |
138+
| `titlecase( s string )` | `string` | Returns `s` with all space characters replaced by dashes. For example, `titlecase("test string")` returns `Test String`. |
133139
| `typeof( value )` | `string` | Returns the type of the given value: `"string"`, `"number"`, `"list"`, `"bool"`, or `"null"`. |
134140
| `match( s string, pattern string )` | `bool` | Returns `true` if the glob pattern `pattern` matches `s`. See below for more details about glob matching. |
141+
| `bool( list or string or number or nil )` | `bool` | Converts the value to a boolean value. |
142+
| `string( list or string or number or nil )` | `string` | Converts the value to a string value. |
143+
| `number( number or string )` | `number` | Converts the value to a number value. |
135144

136145
Functions handle `null` with sensible defaults to make writing FQL more concise.
137146
For example, you can write `length( userId ) > 0` instead of `typeof( userId ) =

0 commit comments

Comments
 (0)