You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/api/public-api/fql.md
+10-1Lines changed: 10 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,9 @@ redirect_from:
10
10
11
11
Destination Filter Reference documentation can be found in the [main Config API reference docs](https://reference.segmentapis.com/#6c12fbe8-9f84-4a6c-848e-76a2325cb3c5).
12
12
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).
14
16
15
17
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 )`.
16
18
@@ -130,8 +132,15 @@ You can use parentheses to group subexpressions for more complex "and / or" logi
130
132
|`contains( s string, sub string )`|`bool`| Returns `true` if string `s` contains string `sub`. |
131
133
|`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. |
132
134
|`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`. |
133
139
|`typeof( value )`|`string`| Returns the type of the given value: `"string"`, `"number"`, `"list"`, `"bool"`, or `"null"`. |
134
140
|`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. |
135
144
136
145
Functions handle `null` with sensible defaults to make writing FQL more concise.
137
146
For example, you can write `length( userId ) > 0` instead of `typeof( userId ) =
0 commit comments