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/config-api/fql.md
+44-63Lines changed: 44 additions & 63 deletions
Original file line number
Diff line number
Diff line change
@@ -1,19 +1,12 @@
1
1
---
2
2
title: Destination Filter Query Language
3
-
hidden: true
4
3
---
5
4
6
5
Destination Filter Reference documentation can be found in the [main Config API reference docs](https://reference.segmentapis.com/#6c12fbe8-9f84-4a6c-848e-76a2325cb3c5).
7
6
8
-
Filter Query Language ("FQL") is a simple language for filtering JSON objects
9
-
used by the Transformations API to conditionally apply transformations. In the
10
-
Transformations API, FQL statements evaluate to `true` or `false` based on the
11
-
contents of each Segment event. If the statement evaluates to `true`, the
12
-
transformation is applied, and if it is `false` the transformation is not applied.
7
+
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
8
14
-
In addition to boolean and equality operators like `and` and `>=`, FQL has
15
-
built-in functions that make it more powerful such as `contains( str, substr )`
16
-
and `match( str, pattern )`.
9
+
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 )`.
17
10
18
11
## Examples
19
12
@@ -53,7 +46,7 @@ properties like `userId` or `event` as well as nested properties like
53
46
`context.library.version` or `properties.title` using dot-separated paths. For
54
47
example, the following fields can be pointed to by the associated field paths:
55
48
56
-
```
49
+
```json
57
50
{
58
51
"type": "...", // type
59
52
"event": "...", // event
@@ -70,9 +63,7 @@ example, the following fields can be pointed to by the associated field paths:
70
63
71
64
### Escaping Field Paths
72
65
73
-
If your field name has a character not in the set of `{a-z A-Z 0-9 _ -}`, you
74
-
must escape it using a `\` character. For example, the nested field
75
-
below can be referred to by `properties.product\ 1.price`:
66
+
If your field name has a character not in the set of `{a-z A-Z 0-9 _ -}`, you must escape it using a `\` character. For example, the nested field below can be referred to by `properties.product\ 1.price`:
76
67
77
68
```json
78
69
{
@@ -96,7 +87,7 @@ below can be referred to by `properties.product\ 1.price`:
|`contains( s string, sub string )`|`bool`| Returns `true` if string `s` contains string `sub`. |
128
118
|`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. |
129
-
|`lowercase( s string )`|`string`| Returns `s` with all uppercase characters replaced with their lowercase equivalent. |
130
-
|`typeof( value )`|`string`| Returns the type of the given value: `"string"`, `"number"`, `"list"`, `"bool"`, or `"null"`. |
131
-
|`match( s string, pattern string )`|`bool`| Returns `true` if the glob pattern `pattern` matches `s`. See below for more details about glob matching. |
119
+
|`lowercase( s string )`|`string`| Returns `s` with all uppercase characters replaced with their lowercase equivalent. |
120
+
|`typeof( value )`|`string`| Returns the type of the given value: `"string"`, `"number"`, `"list"`, `"bool"`, or `"null"`. |
121
+
|`match( s string, pattern string )`|`bool`| Returns `true` if the glob pattern `pattern` matches `s`. See below for more details about glob matching. |
132
122
133
123
Functions handle `null` with sensible defaults to make writing FQL more concise.
134
124
For example, you can write `length( userId ) > 0` instead of `typeof( userId ) =
135
125
'string' and length( userId ) > 0`.
136
126
137
127
| Function | Result |
138
-
|----------------------------|----------|
128
+
|--------------------------|--------|
139
129
|`contains( null, string )`|`false`|
140
130
|`length( null )`|`0`|
141
131
|`lowercase( null )`|`null`|
@@ -144,39 +134,30 @@ For example, you can write `length( userId ) > 0` instead of `typeof( userId ) =
144
134
145
135
### `match( string, pattern )`
146
136
147
-
The `match( string, pattern )` function uses "glob" matching to return `true` if
148
-
the given string fully matches a given pattern. Glob patterns are case
149
-
sensitive. If you only need to determine if a string contains a given substring,
|`match(``'abcd', 'a*d' )`|`true`|`*` matches zero or more characters. |
163
-
|`match( '', '*' )`|`true`|`*` matches zero or more characters. |
164
-
|`match( 'abc', 'ab' )`|`false`| The pattern must match the full string. |
165
-
|`match( 'abcd', 'a??d' )`|`true`|`?` matches one character only. |
166
-
|`match( 'abcd', '*d' )`|`true`|`*` matches one or more characters even at the beginning or end of the string. |
167
-
|`match( 'ab*d', 'ab\*d' )`|`true`|`\*` matches the literal character `*`. |
168
-
|`match( 'abCd', 'ab[cC]d' )`|`true`|`[cC]` matches either `c` or `C`. |
169
-
|`match( 'abcd', 'ab[a-z]d' )`|`true`|`[a-z]` matches any character between `a` and `z`. |
170
-
|`match( 'abcd', 'ab[A-Z]d' )`|`false`|`[A-Z]` matches any character between `A` and `Z` but `c` is not in that range because it is lowercase. |
171
-
172
-
## Errata
173
-
174
-
### Error Handling
175
-
176
-
If your FQL statement is invalid (for example `userId = oops"`), your Segment
177
-
event will not be sent on to downstream Destinations. We default to not sending
178
-
the event to ensure that invalid FQL doesn't cause sensitive information like
179
-
PII to be incorrectly sent to Destinations.
180
-
181
-
For this reason, we strongly recommend that you use the Destination Filters
182
-
"Preview" API to test your filters without impacting your production data.
137
+
The `match( string, pattern )` function uses "glob" matching to return `true` if the given string fully matches a given pattern. Glob patterns are case sensitive. If you only need to determine if a string contains a given substring, you should use `contains()`.
|`match(``'abcd', 'a*d' )`|`true`|`*` matches zero or more characters. |
150
+
|`match( '', '*' )`|`true`|`*` matches zero or more characters. |
151
+
|`match( 'abc', 'ab' )`|`false`| The pattern must match the full string. |
152
+
|`match( 'abcd', 'a??d' )`|`true`|`?` matches one character only. |
153
+
|`match( 'abcd', '*d' )`|`true`|`*` matches one or more characters even at the beginning or end of the string. |
154
+
|`match( 'ab*d', 'ab\*d' )`|`true`|`\*` matches the literal character `*`. |
155
+
|`match( 'abCd', 'ab[cC]d' )`|`true`|`[cC]` matches either `c` or `C`. |
156
+
|`match( 'abcd', 'ab[a-z]d' )`|`true`|`[a-z]` matches any character between `a` and `z`. |
157
+
|`match( 'abcd', 'ab[A-Z]d' )`|`false`|`[A-Z]` matches any character between `A` and `Z` but `c` is not in that range because it is lowercase. |
158
+
159
+
## Error Handling
160
+
161
+
If your FQL statement is invalid (for example `userId = oops"`), your Segment event will not be sent on to downstream Destinations. Segment defaults to not sending the event to ensure that invalid FQL doesn't cause sensitive information like PII to be incorrectly sent to Destinations.
162
+
163
+
For this reason, Segment recommends that you use the Destination Filters "Preview" API to test your filters without impacting your production data.
Copy file name to clipboardExpand all lines: src/connections/destinations/destination-filters.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ Common use cases for Destination Filters include the following:
15
15
- Preventing test or internally-generated events from reaching your production tools
16
16
17
17
> note ""
18
-
> **Note**: Destination Filters are available to Business Tier customers only.
18
+
> Destination Filters are available to Business Tier customers only.
19
19
20
20
### Destination Filtering Limitations
21
21
@@ -42,7 +42,7 @@ To create a Destination Filter, follow these steps:
42
42
43
43
## Destination Filters API
44
44
45
-
The Destination Filters API provides more power than the Segment dashboard's Destination Filters settings. With the API, You can create complex filters that are conditionally applied using Segment's Filter Query Language (FQL).
45
+
The Destination Filters API provides more power than the Segment dashboard's Destination Filters settings. With the API, you can create complex filters that are conditionally applied using Segment's [Filter Query Language (FQL)](/docs/config-api/fql).
46
46
47
47
The Destination Filters API offers four different filter types:
0 commit comments