@sisense/sdk-data 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dimensional-model/filters/factory.d.ts +486 -134
- package/dist/dimensional-model/filters/factory.js +486 -134
- package/dist/index.d.ts +5 -5
- package/dist/index.js +5 -5
- package/package.json +3 -3
|
@@ -1,153 +1,339 @@
|
|
|
1
1
|
import { DateDimension, LevelAttribute, Attribute, Measure, Filter, BaseMeasure, FilterRelationNode, FilterRelation } from '../interfaces.js';
|
|
2
2
|
/**
|
|
3
|
-
* Creates a filter representing
|
|
3
|
+
* Creates a filter representing the union of multiple filters on the same attribute. The resulting
|
|
4
|
+
* union filter filters on items that match any of the given filters.
|
|
4
5
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
6
|
+
* To create 'or' filters using different attributes, use the {@link logic.and | `or()`} function.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* Filter for countries that start with the letter 'A' **or** end with the letter 'A'
|
|
10
|
+
* in the Sample ECommerce data model.
|
|
11
|
+
* ```ts
|
|
12
|
+
* filterFactory.union([
|
|
13
|
+
* filterFactory.startsWith(DM.Country.Country, 'A'),
|
|
14
|
+
* filterFactory.endsWith(DM.Country.Country, 'A'),
|
|
15
|
+
* ])
|
|
16
|
+
* ```
|
|
17
|
+
* @param filters - Filters to union. The filters must all be on the same attribute.
|
|
18
|
+
* @returns A filter instance
|
|
7
19
|
*/
|
|
8
20
|
export declare function union(filters: Filter[]): Filter;
|
|
9
21
|
/**
|
|
10
|
-
* Creates a filter representing
|
|
22
|
+
* Creates a filter representing the intersection of multiple filters on the same attribute. The resulting
|
|
23
|
+
* intersection filter filters on items that match all of the given filters.
|
|
24
|
+
*
|
|
25
|
+
* To create 'and' filters using different attributes, use the {@link logic.and | `and()`} function.
|
|
11
26
|
*
|
|
12
|
-
* @
|
|
13
|
-
*
|
|
27
|
+
* @example
|
|
28
|
+
* Filter for countries that start with the letter 'A' **and** end with the letter 'A'
|
|
29
|
+
* in the Sample ECommerce data model.
|
|
30
|
+
* ```ts
|
|
31
|
+
* filterFactory.intersection([
|
|
32
|
+
* filterFactory.startsWith(DM.Country.Country, 'A'),
|
|
33
|
+
* filterFactory.endsWith(DM.Country.Country, 'A'),
|
|
34
|
+
* ])
|
|
35
|
+
* ```
|
|
36
|
+
* @param filters - Filters to intersect. The filters must all be on the same attribute.
|
|
37
|
+
* @returns A filter instance
|
|
14
38
|
*/
|
|
15
39
|
export declare function intersection(filters: Filter[]): Filter;
|
|
16
40
|
/**
|
|
17
|
-
* Creates a filter
|
|
18
|
-
* from all
|
|
41
|
+
* Creates a filter that excludes items matching the given filter
|
|
42
|
+
* from all items or from items matching the optional input filter.
|
|
19
43
|
*
|
|
44
|
+
* @example
|
|
45
|
+
* Filter for items where the country name does not contain the letter 'A'
|
|
46
|
+
* from the Sample ECommerce data model.
|
|
47
|
+
* ```ts
|
|
48
|
+
* filterFactory.exclude(filterFactory.contains(DM.Country.Country, 'A'))
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* Filter for items where the country name starts with the letter 'B' but does not contain the letter 'A'
|
|
52
|
+
* from the Sample ECommerce data model. This filter will match countries like 'Belgium', but will not
|
|
53
|
+
* match countries like 'Bermuda'.
|
|
54
|
+
* ```ts
|
|
55
|
+
* filterFactory.exclude(
|
|
56
|
+
* filterFactory.contains(DM.Country.Country, 'A'),
|
|
57
|
+
* filterFactory.startsWith(DM.Country.Country, 'B')
|
|
58
|
+
* )
|
|
59
|
+
* ```
|
|
20
60
|
* @param filter - Filter to exclude
|
|
21
|
-
* @param input - Input filter to exclude from
|
|
61
|
+
* @param input - Input filter to exclude from, on the same attribute. If not provided, the filter excludes from all items.
|
|
22
62
|
* @returns A filter representing an exclusion of the given filter
|
|
23
63
|
* from all attribute members or from the optional input filter
|
|
24
64
|
*/
|
|
25
65
|
export declare function exclude(filter: Filter, input?: Filter): Filter;
|
|
26
66
|
/**
|
|
27
|
-
* Creates a
|
|
67
|
+
* Creates a filter to isolate attribute values that do not contain a specified string.
|
|
28
68
|
*
|
|
29
|
-
*
|
|
69
|
+
* Matching is case insensitive.
|
|
70
|
+
*
|
|
71
|
+
* You can optionally use wildcard characters for pattern matching, as described in the
|
|
72
|
+
* {@link like | `like()`} function.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* Filter for categories in the Sample ECommerce data model where the category name doesn't contain
|
|
76
|
+
* 'digital'. This filter matches categories not like 'Digital Cameras' and 'MP3 & Digital Media Players'.
|
|
77
|
+
* ```ts
|
|
78
|
+
* filterFactory.contains(DM.Category.Category, 'digital')
|
|
79
|
+
* ```
|
|
80
|
+
* @param attribute - Text attribute to filter on
|
|
30
81
|
* @param value - Value to filter by
|
|
31
|
-
* @returns A
|
|
82
|
+
* @returns A filter instance
|
|
32
83
|
*/
|
|
33
84
|
export declare function doesntContain(attribute: Attribute, value: string): Filter;
|
|
34
85
|
/**
|
|
35
|
-
* Creates a
|
|
86
|
+
* Creates a filter to isolate attribute values that do not end with a specified string.
|
|
87
|
+
*
|
|
88
|
+
* Matching is case insensitive.
|
|
36
89
|
*
|
|
37
|
-
*
|
|
90
|
+
* You can optionally use wildcard characters for pattern matching, as described in the
|
|
91
|
+
* {@link like | `like()`} function.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* Filter for countries in the Sample ECommerce data model where the country name doesn't end with
|
|
95
|
+
* 'land'. This filter matches countries not like 'Iceland' and 'Ireland'.
|
|
96
|
+
* ```ts
|
|
97
|
+
* filterFactory.doesntEndWith(DM.Country.Country, 'land')
|
|
98
|
+
* ```
|
|
99
|
+
* @param attribute - Text attribute to filter on
|
|
38
100
|
* @param value - Value to filter by
|
|
39
|
-
* @returns A
|
|
101
|
+
* @returns A filter instance
|
|
40
102
|
*/
|
|
41
103
|
export declare function doesntEndWith(attribute: Attribute, value: string): Filter;
|
|
42
104
|
/**
|
|
43
|
-
* Creates a
|
|
105
|
+
* Creates a filter to isolate attribute values that do not start with a specified string.
|
|
106
|
+
*
|
|
107
|
+
* Matching is case insensitive.
|
|
44
108
|
*
|
|
45
|
-
*
|
|
109
|
+
* You can optionally use wildcard characters for pattern matching, as described in the
|
|
110
|
+
* {@link like | `like()`} function.
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* Filter for countries in the Sample ECommerce data model where the country name doesn't start with
|
|
114
|
+
* 'United'. This filter matches countries not like 'United States' and 'United Kingdom'.
|
|
115
|
+
* ```ts
|
|
116
|
+
* filterFactory.doesntStartWith(DM.Country.Country, 'United')
|
|
117
|
+
* ```
|
|
118
|
+
* @param attribute - Text attribute to filter on
|
|
46
119
|
* @param value - Value to filter by
|
|
47
|
-
* @returns A
|
|
120
|
+
* @returns A filter instance
|
|
48
121
|
*/
|
|
49
122
|
export declare function doesntStartWith(attribute: Attribute, value: string): Filter;
|
|
50
123
|
/**
|
|
51
|
-
* Creates a
|
|
124
|
+
* Creates a filter to isolate attribute values that contain a specified string.
|
|
52
125
|
*
|
|
53
|
-
*
|
|
126
|
+
* Matching is case insensitive.
|
|
127
|
+
*
|
|
128
|
+
* You can optionally use wildcard characters for pattern matching, as described in the
|
|
129
|
+
* {@link like | `like()`} function.
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* Filter for categories in the Sample ECommerce data model where the category name contains
|
|
133
|
+
* 'digital'. This filter matches categories like 'Digital Cameras' and 'MP3 & Digital Media Players'.
|
|
134
|
+
* ```ts
|
|
135
|
+
* filterFactory.contains(DM.Category.Category, 'digital')
|
|
136
|
+
* ```
|
|
137
|
+
* @param attribute - Text attribute to filter on
|
|
54
138
|
* @param value - Value to filter by
|
|
55
|
-
* @returns A
|
|
139
|
+
* @returns A filter instance
|
|
56
140
|
*/
|
|
57
141
|
export declare function contains(attribute: Attribute, value: string): Filter;
|
|
58
142
|
/**
|
|
59
|
-
* Creates
|
|
143
|
+
* Creates a filter to isolate attribute values that end with a specified string.
|
|
144
|
+
*
|
|
145
|
+
* Matching is case insensitive.
|
|
60
146
|
*
|
|
61
|
-
*
|
|
147
|
+
* You can optionally use wildcard characters for pattern matching, as described in the
|
|
148
|
+
* {@link like | `like()`} function.
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* Filter for countries in the Sample ECommerce data model where the country name ends with
|
|
152
|
+
* 'land'. This filter matches countries like 'Ireland' and 'Iceland'.
|
|
153
|
+
* ```ts
|
|
154
|
+
* filterFactory.endsWith(DM.Country.Country, 'land')
|
|
155
|
+
* ```
|
|
156
|
+
* @param attribute - Text attribute to filter on
|
|
62
157
|
* @param value - Value to filter by
|
|
63
|
-
* @returns A
|
|
158
|
+
* @returns A filter instance
|
|
64
159
|
*/
|
|
65
160
|
export declare function endsWith(attribute: Attribute, value: string): Filter;
|
|
66
161
|
/**
|
|
67
|
-
* Creates a
|
|
162
|
+
* Creates a filter to isolate attribute values that start with a specified string.
|
|
163
|
+
*
|
|
164
|
+
* Matching is case insensitive.
|
|
68
165
|
*
|
|
69
|
-
*
|
|
166
|
+
* You can optionally use wildcard characters for pattern matching, as described in the
|
|
167
|
+
* {@link like | `like()`} function.
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* Filter for countries in the Sample ECommerce data model where the country name starts with
|
|
171
|
+
* 'United'. This filter matches countries like 'United States' and 'United Kingdom'.
|
|
172
|
+
* ```ts
|
|
173
|
+
* filterFactory.startsWith(DM.Country.Country, 'United')
|
|
174
|
+
* ```
|
|
175
|
+
* @param attribute - Text attribute to filter on
|
|
70
176
|
* @param value - Value to filter by
|
|
71
|
-
* @returns A
|
|
177
|
+
* @returns A filter instance
|
|
72
178
|
*/
|
|
73
179
|
export declare function startsWith(attribute: Attribute, value: string): Filter;
|
|
74
180
|
/**
|
|
75
|
-
* Creates a
|
|
181
|
+
* Creates a filter to isolate attribute values that match a specified string pattern.
|
|
182
|
+
*
|
|
183
|
+
* The pattern can include the following wildcard characters:
|
|
184
|
+
*
|
|
185
|
+
* + `_`: Matches a single character
|
|
186
|
+
* + `%`: Matches multiple characters
|
|
187
|
+
*
|
|
188
|
+
* To search for a literal underscore (`_`) or percent symbol (`%`), use the backslash (`\`) escape
|
|
189
|
+
* character.
|
|
190
|
+
*
|
|
191
|
+
* Matching is case insensitive.
|
|
76
192
|
*
|
|
77
|
-
* @
|
|
193
|
+
* @example
|
|
194
|
+
* Filter for countries from the Sample ECommerce data model where the country name starts with an
|
|
195
|
+
* 'A' and ends with an 'a'. This filter matches countries like 'Argentina' and 'Australia'.
|
|
196
|
+
* ```ts
|
|
197
|
+
* filterFactory.like(DM.Country.Country, 'A%a')
|
|
198
|
+
* ```
|
|
199
|
+
* @param attribute - Text attribute to filter on
|
|
78
200
|
* @param value - Value to filter by
|
|
79
|
-
* @returns A
|
|
201
|
+
* @returns A filter instance
|
|
80
202
|
*/
|
|
81
203
|
export declare function like(attribute: Attribute, value: string): Filter;
|
|
82
204
|
/**
|
|
83
|
-
* Creates a
|
|
205
|
+
* Creates a filter to isolate attribute values that do not equal a specified string or number.
|
|
206
|
+
*
|
|
207
|
+
* When filtering against a string:
|
|
84
208
|
*
|
|
85
|
-
*
|
|
209
|
+
* + Matching is case insensitive.
|
|
210
|
+
* + You can optionally use wildcard characters for pattern matching, as described in the
|
|
211
|
+
* {@link like | `like()`} function.
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* Filter for items not in new condition from the Sample ECommerce data model.
|
|
215
|
+
* ```ts
|
|
216
|
+
* filterFactory.doesntEqual(DM.Commerce.Condition, 'New')
|
|
217
|
+
* ```
|
|
218
|
+
* @param attribute - Text or numeric attribute to filter on
|
|
86
219
|
* @param value - Value to filter by
|
|
87
|
-
* @returns A filter
|
|
220
|
+
* @returns A filter instance
|
|
88
221
|
*/
|
|
89
222
|
export declare function doesntEqual(attribute: Attribute, value: string | number): Filter;
|
|
90
223
|
/**
|
|
91
|
-
* Creates
|
|
224
|
+
* Creates a filter to isolate attribute values that equal a specified string or number.
|
|
92
225
|
*
|
|
93
|
-
*
|
|
226
|
+
* When filtering against a string:
|
|
227
|
+
*
|
|
228
|
+
* + Matching is case insensitive.
|
|
229
|
+
* + You can optionally use wildcard characters for pattern matching, as described in the
|
|
230
|
+
* {@link like | `like()`} function.
|
|
231
|
+
*
|
|
232
|
+
* @example
|
|
233
|
+
* Filter for items in new condition from the Sample ECommerce data model.
|
|
234
|
+
* ```ts
|
|
235
|
+
* filterFactory.equals(DM.Commerce.Condition, 'New')
|
|
236
|
+
* ```
|
|
237
|
+
* @param attribute - Text or numeric attribute to filter on
|
|
94
238
|
* @param value - Value to filter by
|
|
95
|
-
* @returns A filter
|
|
239
|
+
* @returns A filter instance
|
|
96
240
|
*/
|
|
97
241
|
export declare function equals(attribute: Attribute, value: string | number): Filter;
|
|
98
242
|
/**
|
|
99
|
-
* Creates a
|
|
243
|
+
* Creates a filter to isolate attribute values strictly greater than a specified number.
|
|
100
244
|
*
|
|
101
|
-
* @
|
|
245
|
+
* @example
|
|
246
|
+
* Filter for items where the cost is greater than 100 from the Sample ECommerce data model.
|
|
247
|
+
* ```ts
|
|
248
|
+
* filterFactory.greaterThan(DM.Commerce.Cost, 100)
|
|
249
|
+
* ```
|
|
250
|
+
* @param attribute - Numeric attribute to filter on
|
|
102
251
|
* @param value - Value to filter by
|
|
103
|
-
* @returns A
|
|
252
|
+
* @returns A filter instance
|
|
104
253
|
*/
|
|
105
254
|
export declare function greaterThan(attribute: Attribute, value: number): Filter;
|
|
106
255
|
/**
|
|
107
|
-
* Creates a
|
|
256
|
+
* Creates a filter to isolate attribute values greater than or equal to a specified number.
|
|
108
257
|
*
|
|
109
|
-
* @
|
|
258
|
+
* @example
|
|
259
|
+
* Filter for items where the cost is greater than or equal to 100 from the Sample ECommerce data model.
|
|
260
|
+
* ```ts
|
|
261
|
+
* filterFactory.greaterThanOrEqual(DM.Commerce.Cost, 100)
|
|
262
|
+
* ```
|
|
263
|
+
* @param attribute - Numeric attribute to filter on
|
|
110
264
|
* @param value - Value to filter by
|
|
111
|
-
* @returns A
|
|
265
|
+
* @returns A filter instance
|
|
112
266
|
*/
|
|
113
267
|
export declare function greaterThanOrEqual(attribute: Attribute, value: number): Filter;
|
|
114
268
|
/**
|
|
115
|
-
* Creates a
|
|
269
|
+
* Creates a filter to isolate attribute values strictly less than a specified number.
|
|
116
270
|
*
|
|
117
|
-
* @
|
|
271
|
+
* @example
|
|
272
|
+
* Filter for items where the cost is less than 100 from the Sample ECommerce data model.
|
|
273
|
+
* ```ts
|
|
274
|
+
* filterFactory.lessThan(DM.Commerce.Cost, 100)
|
|
275
|
+
* ```
|
|
276
|
+
* @param attribute - Numeric attribute to filter on
|
|
118
277
|
* @param value - Value to filter by
|
|
119
|
-
* @returns A
|
|
278
|
+
* @returns A filter instance
|
|
120
279
|
*/
|
|
121
280
|
export declare function lessThan(attribute: Attribute, value: number): Filter;
|
|
122
281
|
/**
|
|
123
|
-
* Creates a
|
|
282
|
+
* Creates a filter to isolate attribute values less than or equal to a specified number.
|
|
124
283
|
*
|
|
125
|
-
* @
|
|
284
|
+
* @example
|
|
285
|
+
* Filter for items where the cost is less than or equal to 100 from the Sample ECommerce data model.
|
|
286
|
+
* ```ts
|
|
287
|
+
* filterFactory.lessThanOrEqual(DM.Commerce.Cost, 100)
|
|
288
|
+
* ```
|
|
289
|
+
* @param attribute - Numeric attribute to filter on
|
|
126
290
|
* @param value - Value to filter by
|
|
127
|
-
* @returns A
|
|
291
|
+
* @returns A filter instance
|
|
128
292
|
*/
|
|
129
293
|
export declare function lessThanOrEqual(attribute: Attribute, value: number): Filter;
|
|
130
294
|
/**
|
|
131
|
-
* Creates a
|
|
295
|
+
* Creates a filter to isolate attribute values within or exactly matching two specified numerical boundaries.
|
|
132
296
|
*
|
|
133
|
-
* @
|
|
297
|
+
* @example
|
|
298
|
+
* Filter for items from the Sample ECommerce data model where the cost is greater than or equal to 100 and less than or equal to 200.
|
|
299
|
+
* ```ts
|
|
300
|
+
* filterFactory.between(DM.Commerce.Cost, 100, 200)
|
|
301
|
+
* ```
|
|
302
|
+
* @param attribute - Numeric attribute to filter on
|
|
134
303
|
* @param valueA - Value to filter from
|
|
135
304
|
* @param valueB - Value to filter to
|
|
136
|
-
* @returns A
|
|
305
|
+
* @returns A filter instance
|
|
137
306
|
*/
|
|
138
307
|
export declare function between(attribute: Attribute, valueA: number, valueB: number): Filter;
|
|
139
308
|
/**
|
|
140
|
-
* Creates a
|
|
309
|
+
* Creates a filter that isolates attribute values strictly within two specified numerical boundaries.
|
|
141
310
|
*
|
|
142
|
-
* @
|
|
311
|
+
* @example
|
|
312
|
+
* Filter for items from the Sample ECommerce data model where the cost is greater than 100 and less than 200.
|
|
313
|
+
* ```ts
|
|
314
|
+
* filterFactory.betweenNotEqual(DM.Commerce.Cost, 100, 200)
|
|
315
|
+
* ```
|
|
316
|
+
* @param attribute - Numeric attribute to filter on
|
|
143
317
|
* @param valueA - Value to filter from
|
|
144
318
|
* @param valueB - Value to filter to
|
|
145
|
-
* @returns A
|
|
319
|
+
* @returns A filter instance
|
|
146
320
|
*/
|
|
147
321
|
export declare function betweenNotEqual(attribute: Attribute, valueA: number, valueB: number): Filter;
|
|
148
322
|
/**
|
|
149
|
-
* Creates a custom numeric filter.
|
|
323
|
+
* Creates a custom numeric filter that filters for given attribute values.
|
|
150
324
|
*
|
|
325
|
+
* @example
|
|
326
|
+
* Filter for items where the cost is greater than 100 and less than 200
|
|
327
|
+
* from the Sample ECommerce data model.
|
|
328
|
+
* ```ts
|
|
329
|
+
* filterFactory.numeric(
|
|
330
|
+
* DM.Commerce.Cost,
|
|
331
|
+
* NumericOperators.From,
|
|
332
|
+
* 100,
|
|
333
|
+
* NumericOperators.To,
|
|
334
|
+
* 200
|
|
335
|
+
* )
|
|
336
|
+
* ```
|
|
151
337
|
* @param attribute - Numeric attribute to filter
|
|
152
338
|
* @param operatorA - First operator
|
|
153
339
|
* @param valueA - First value
|
|
@@ -157,95 +343,171 @@ export declare function betweenNotEqual(attribute: Attribute, valueA: number, va
|
|
|
157
343
|
*/
|
|
158
344
|
export declare function numeric(attribute: Attribute, operatorA?: string, valueA?: number, operatorB?: string, valueB?: number): Filter;
|
|
159
345
|
/**
|
|
160
|
-
* Creates a filter
|
|
346
|
+
* Creates a filter to isolate attribute values that match any of the specified strings.
|
|
161
347
|
*
|
|
162
|
-
*
|
|
348
|
+
* Matching is case sensitive.
|
|
349
|
+
*
|
|
350
|
+
* @example
|
|
351
|
+
* Filter for items where the condition is 'Used' or 'Refurbished'
|
|
352
|
+
* from the Sample ECommerce data model.
|
|
353
|
+
* ```ts
|
|
354
|
+
* filterFactory.members(DM.Commerce.Condition, ['Used', 'Refurbished'])
|
|
355
|
+
* ```
|
|
356
|
+
* @param attribute - Attribute to filter on
|
|
163
357
|
* @param members - Array of member values to filter by
|
|
164
|
-
* @returns A filter instance
|
|
358
|
+
* @returns A filter instance
|
|
165
359
|
*/
|
|
166
360
|
export declare function members(attribute: Attribute, members: string[]): Filter;
|
|
167
361
|
/**
|
|
168
|
-
* Creates a filter
|
|
362
|
+
* Creates a filter to isolate date values starting from and including the given date and level.
|
|
169
363
|
*
|
|
170
|
-
* @
|
|
171
|
-
*
|
|
172
|
-
*
|
|
364
|
+
* @example
|
|
365
|
+
* Filter for items in the Sample ECommerce data model where the date is not before the year 2010.
|
|
366
|
+
* ```ts
|
|
367
|
+
* filterFactory.dateFrom(DM.Commerce.Date.Years, '2010-01')
|
|
368
|
+
* ```
|
|
369
|
+
* @param level - Date {@link LevelAttribute} to filter on
|
|
370
|
+
* @param from - Date or string representing the value to filter from
|
|
371
|
+
* @returns A filter instance
|
|
173
372
|
*/
|
|
174
373
|
export declare function dateFrom(level: LevelAttribute, from: Date | string): Filter;
|
|
175
374
|
/**
|
|
176
|
-
* Creates a filter
|
|
375
|
+
* Creates a filter to isolate items up until and including the given date and level.
|
|
177
376
|
*
|
|
178
|
-
* @
|
|
179
|
-
*
|
|
180
|
-
*
|
|
377
|
+
* @example
|
|
378
|
+
* Filter for items where the date is from the year 2010 or earlier in the Sample ECommerce data model.
|
|
379
|
+
* ```ts
|
|
380
|
+
* filterFactory.dateTo(DM.Commerce.Date.Years, '2010-01')
|
|
381
|
+
* ```
|
|
382
|
+
* @param level - Date {@link LevelAttribute} to filter on
|
|
383
|
+
* @param to - Date or string representing the last member to filter to
|
|
384
|
+
* @returns A filter instance
|
|
181
385
|
*/
|
|
182
386
|
export declare function dateTo(level: LevelAttribute, to: Date | string): Filter;
|
|
183
387
|
/**
|
|
184
|
-
* Creates a
|
|
388
|
+
* Creates a filter to isolate items between and including the given dates and level.
|
|
185
389
|
*
|
|
186
|
-
* @
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
390
|
+
* @example
|
|
391
|
+
* Filter for items in the Sample ECommerce data model where the date is from the years 2009, 2010, or 2011.
|
|
392
|
+
* ```ts
|
|
393
|
+
* filterFactory.dateRange(DM.Commerce.Date.Years, '2009-01', '2011-01')
|
|
394
|
+
* ```
|
|
395
|
+
* @param level - Date {@link LevelAttribute} to filter on
|
|
396
|
+
* @param from - Date or string representing the start member to filter from
|
|
397
|
+
* @param to - Date or string representing the end member to filter to
|
|
398
|
+
* @returns A filter instance
|
|
190
399
|
*/
|
|
191
400
|
export declare function dateRange(level: LevelAttribute, from?: Date | string, to?: Date | string): Filter;
|
|
192
401
|
/**
|
|
193
|
-
* Creates a
|
|
402
|
+
* Creates a filter to isolate items with a date dimension value within a specified range after a
|
|
403
|
+
* given date and level.
|
|
194
404
|
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
* @
|
|
405
|
+
* Although the `offset` can be used to set a beginning date prior to the `anchor`, the filter range always
|
|
406
|
+
* continues forward after the offset beginning date. So, using an `offset` of `-6` and a `count` of `18` when `level`
|
|
407
|
+
* is a month level creates a range that begins 6 month before the `anchor` date and extends to 12 months after
|
|
408
|
+
* the `anchor` date.
|
|
409
|
+
*
|
|
410
|
+
* @example
|
|
411
|
+
* Filter for items in the Sample ECommerce data model where the date is in 2011 or the first half of 2012.
|
|
412
|
+
* ```ts
|
|
413
|
+
* filterFactory.dateRelative(DM.Commerce.Date.Months, 0, 18, '2011-01'),
|
|
414
|
+
* ```
|
|
415
|
+
*
|
|
416
|
+
* Filter for items in the Sample ECommerce data model where the date is in the second half of 2010 or in 2011.
|
|
417
|
+
* ```ts
|
|
418
|
+
* filterFactory.dateRelative(DM.Commerce.Date.Months, -6, 18, '2011-01'),
|
|
419
|
+
* ```
|
|
420
|
+
*
|
|
421
|
+
* Filter for items in the Sample ECommerce data model where the date is in the past 6 months.
|
|
422
|
+
* ```ts
|
|
423
|
+
* filterFactory.dateRelative(DM.Commerce.Date.Months, -6, 6),
|
|
424
|
+
* ```
|
|
425
|
+
* @param level - Date {@link LevelAttribute} to filter on
|
|
426
|
+
* @param offset - Number of levels to skip from the given `anchor` or the default of the current day.
|
|
427
|
+
* Positive numbers skip forwards and negative numbers skip backwards (e.g. `-6` is 6 months backwards when `level` is a months level attribute)
|
|
428
|
+
* @param count - Number of levels to include in the filter (e.g. `6` is 6 months when `level` is a months level attribute)
|
|
429
|
+
* @param anchor - Date to filter from, defaults to the current day
|
|
430
|
+
* @returns A filter instance
|
|
201
431
|
*/
|
|
202
432
|
export declare function dateRelative(level: LevelAttribute, offset: number, count: number, anchor?: Date | string): Filter;
|
|
203
433
|
/**
|
|
204
|
-
* Creates a
|
|
434
|
+
* Creates a filter to isolate items with a date dimension value within a specified range after a
|
|
435
|
+
* given date and level.
|
|
205
436
|
*
|
|
206
|
-
* @
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
437
|
+
* @example
|
|
438
|
+
* Filter for items in the Sample ECommerce data model where the date is in 2011 or the first half of 2012.
|
|
439
|
+
* ```ts
|
|
440
|
+
* filterFactory.dateRelativeFrom(DM.Commerce.Date.Months, 0, 18, '2011-01'),
|
|
441
|
+
* ```
|
|
442
|
+
* @param level - Date {@link LevelAttribute} to filter on
|
|
443
|
+
* @param offset - Number of levels to skip from the given `anchor` or the default of the current day (e.g. `6` is 6 months when `level` is a months level attribute)
|
|
444
|
+
* @param count - Number of levels to include in the filter (e.g. `6` is 6 months when `level` is a months level attribute)
|
|
445
|
+
* @param anchor - Date to filter from, defaults to the current day
|
|
446
|
+
* @returns A filter instance
|
|
211
447
|
*/
|
|
212
448
|
export declare function dateRelativeFrom(level: LevelAttribute, offset: number, count: number, anchor?: Date | string): Filter;
|
|
213
449
|
/**
|
|
214
|
-
* Creates a
|
|
450
|
+
* Creates a filter to isolate items with a date dimension value within a specified range before a
|
|
451
|
+
* given date and level.
|
|
215
452
|
*
|
|
216
|
-
* @
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
453
|
+
* @example
|
|
454
|
+
* Filter for items in the Sample ECommerce data model where the date is in the first half of 2010 or in 2011.
|
|
455
|
+
* ```ts
|
|
456
|
+
* filterFactory.dateRelativeTo(DM.Commerce.Date.Months, 0, 18, '2011-12'),
|
|
457
|
+
* ```
|
|
458
|
+
* @param level - Date {@link LevelAttribute} to filter on
|
|
459
|
+
* @param offset - Number of levels to skip from the given `anchor` or the default of the current day (e.g. `6` is 6 months when `level` is a months level attribute)
|
|
460
|
+
* @param count - Number of levels to include in the filter (e.g. `6` is 6 months when `level` is a months level attribute)
|
|
461
|
+
* @param anchor - Date to filter to, defaults to the current day
|
|
462
|
+
* @returns A filter instance
|
|
221
463
|
*/
|
|
222
464
|
export declare function dateRelativeTo(level: LevelAttribute, offset: number, count: number, anchor?: Date | string): Filter;
|
|
223
465
|
/**
|
|
224
|
-
* Creates a filter
|
|
466
|
+
* Creates a filter to isolate items with a date dimension value in the current calendar year.
|
|
225
467
|
*
|
|
226
|
-
* @
|
|
227
|
-
*
|
|
468
|
+
* @example
|
|
469
|
+
* Filter for items where the date is in the current calendar year in the Sample ECommerce data model.
|
|
470
|
+
* ```ts
|
|
471
|
+
* filterFactory.thisYear(DM.Commerce.Date)
|
|
472
|
+
* ```
|
|
473
|
+
* @param dimension - Date dimension to filter
|
|
474
|
+
* @returns A filter instance
|
|
228
475
|
*/
|
|
229
476
|
export declare function thisYear(dimension: DateDimension): Filter;
|
|
230
477
|
/**
|
|
231
|
-
* Creates a filter
|
|
478
|
+
* Creates a filter to isolate items with a date dimension value in the current calendar month.
|
|
232
479
|
*
|
|
233
|
-
* @
|
|
234
|
-
*
|
|
480
|
+
* @example
|
|
481
|
+
* Filter for items where the date is in the current calendar month in the Sample ECommerce data model.
|
|
482
|
+
* ```ts
|
|
483
|
+
* filterFactory.thisMonth(DM.Commerce.Date)
|
|
484
|
+
* ```
|
|
485
|
+
* @param dimension - Date dimension to filter
|
|
486
|
+
* @returns A filter instance
|
|
235
487
|
*/
|
|
236
488
|
export declare function thisMonth(dimension: DateDimension): Filter;
|
|
237
489
|
/**
|
|
238
|
-
* Creates a filter
|
|
490
|
+
* Creates a filter to isolate items with a date dimension value in the current quarter.
|
|
239
491
|
*
|
|
240
|
-
* @
|
|
241
|
-
*
|
|
492
|
+
* @example
|
|
493
|
+
* Filter for items where the date is in the current quarter in the Sample ECommerce data model.
|
|
494
|
+
* ```ts
|
|
495
|
+
* filterFactory.thisQuarter(DM.Commerce.Date)
|
|
496
|
+
* ```
|
|
497
|
+
* @param dimension - Date dimension to filter
|
|
498
|
+
* @returns A filter instance
|
|
242
499
|
*/
|
|
243
500
|
export declare function thisQuarter(dimension: DateDimension): Filter;
|
|
244
501
|
/**
|
|
245
|
-
* Creates a filter
|
|
502
|
+
* Creates a filter to isolate items with a date dimension value of the current date.
|
|
246
503
|
*
|
|
504
|
+
* @example
|
|
505
|
+
* Filter for items where the date is today in the Sample ECommerce data model.
|
|
506
|
+
* ```ts
|
|
507
|
+
* filterFactory.today(DM.Commerce.Date)
|
|
508
|
+
* ```
|
|
247
509
|
* @param dimension - date dimension to filter
|
|
248
|
-
* @returns A
|
|
510
|
+
* @returns A filter instance
|
|
249
511
|
*/
|
|
250
512
|
export declare function today(dimension: DateDimension): Filter;
|
|
251
513
|
/**
|
|
@@ -262,55 +524,111 @@ export declare function today(dimension: DateDimension): Filter;
|
|
|
262
524
|
*/
|
|
263
525
|
export declare function measureBase(attribute: Attribute, measure: Measure, operatorA?: string, valueA?: number, operatorB?: string, valueB?: number): Filter;
|
|
264
526
|
/**
|
|
265
|
-
* Creates a filter
|
|
527
|
+
* Creates a filter to isolate a measure value greater than or equal to a given number.
|
|
266
528
|
*
|
|
529
|
+
* @example
|
|
530
|
+
* Filter for categories that have an average revenue greater than
|
|
531
|
+
* or equal to 50 in the Sample ECommerce data model.
|
|
532
|
+
* ```ts
|
|
533
|
+
* filterFactory.measureGreaterThanOrEqual(
|
|
534
|
+
* measures.average(DM.Commerce.Revenue),
|
|
535
|
+
* 50
|
|
536
|
+
* )
|
|
537
|
+
* ```
|
|
267
538
|
* @param measure - Measure to filter by
|
|
268
539
|
* @param value - Min value
|
|
269
|
-
* @returns A filter
|
|
540
|
+
* @returns A filter instance
|
|
270
541
|
*/
|
|
271
542
|
export declare function measureGreaterThanOrEqual(measure: BaseMeasure, value: number): Filter;
|
|
272
543
|
/**
|
|
273
|
-
* Creates a filter
|
|
544
|
+
* Creates a filter to isolate a measure value less than or equal to a given number.
|
|
274
545
|
*
|
|
546
|
+
* @example
|
|
547
|
+
* Filter for categories that have an average revenue less than
|
|
548
|
+
* or equal to 100 in the Sample ECommerce data model.
|
|
549
|
+
* ```ts
|
|
550
|
+
* filterFactory.measureLessThanOrEqual(
|
|
551
|
+
* measures.average(DM.Commerce.Revenue),
|
|
552
|
+
* 100
|
|
553
|
+
* )
|
|
554
|
+
* ```
|
|
275
555
|
* @param measure - Measure to filter by
|
|
276
556
|
* @param value - Max value
|
|
277
|
-
* @returns A filter
|
|
557
|
+
* @returns A filter instance
|
|
278
558
|
*/
|
|
279
559
|
export declare function measureLessThanOrEqual(measure: BaseMeasure, value: number): Filter;
|
|
280
560
|
/**
|
|
281
|
-
* Creates a filter
|
|
561
|
+
* Creates a filter to isolate a measure value between or equal to two given numbers.
|
|
282
562
|
*
|
|
563
|
+
* @example
|
|
564
|
+
* Filter for categories that have an average revenue greater than or equal to 50 and less than
|
|
565
|
+
* or equal to 100 in the Sample ECommerce data model.
|
|
566
|
+
* ```ts
|
|
567
|
+
* filterFactory.measureBetween(
|
|
568
|
+
* measures.average(DM.Commerce.Revenue),
|
|
569
|
+
* 50,
|
|
570
|
+
* 100
|
|
571
|
+
* )
|
|
572
|
+
* ```
|
|
283
573
|
* @param measure - Measure to filter by
|
|
284
574
|
* @param valueA - Min value
|
|
285
575
|
* @param valueB - Max value
|
|
286
|
-
* @returns A filter
|
|
576
|
+
* @returns A filter instance
|
|
287
577
|
*/
|
|
288
578
|
export declare function measureBetween(measure: BaseMeasure, valueA: number, valueB: number): Filter;
|
|
289
579
|
/**
|
|
290
|
-
* Creates a filter
|
|
580
|
+
* Creates a filter to isolate a measure value between but not equal to two given numbers.
|
|
291
581
|
*
|
|
582
|
+
* @example
|
|
583
|
+
* Filter for categories that have an average revenue greater than 50 and less than
|
|
584
|
+
* 100 in the Sample ECommerce data model.
|
|
585
|
+
* ```ts
|
|
586
|
+
* filterFactory.measureBetweenNotEqual(
|
|
587
|
+
* measures.average(DM.Commerce.Revenue),
|
|
588
|
+
* 50,
|
|
589
|
+
* 100
|
|
590
|
+
* )
|
|
591
|
+
* ```
|
|
292
592
|
* @param measure - Measure to filter by
|
|
293
593
|
* @param valueA - Min value
|
|
294
594
|
* @param valueB - Max value
|
|
295
|
-
* @returns A filter
|
|
595
|
+
* @returns A filter instance
|
|
296
596
|
*/
|
|
297
597
|
export declare function measureBetweenNotEqual(measure: BaseMeasure, valueA: number, valueB: number): Filter;
|
|
298
598
|
/**
|
|
299
|
-
* Creates a filter
|
|
599
|
+
* Creates a filter to isolate items that rank towards the top for a given measure.
|
|
300
600
|
*
|
|
601
|
+
* @example
|
|
602
|
+
* Filter for age ranges with the top 3 highest total revenue in the Sample ECommerce data model.
|
|
603
|
+
* ```ts
|
|
604
|
+
* filterFactory.topRanking(
|
|
605
|
+
* DM.Commerce.AgeRange,
|
|
606
|
+
* measures.sum(DM.Commerce.Revenue),
|
|
607
|
+
* 3
|
|
608
|
+
* )
|
|
609
|
+
* ```
|
|
301
610
|
* @param attribute - Attribute to filter
|
|
302
611
|
* @param measure - Measure to filter by
|
|
303
612
|
* @param count - Number of members to return
|
|
304
|
-
* @returns A filter
|
|
613
|
+
* @returns A filter instance
|
|
305
614
|
*/
|
|
306
615
|
export declare function topRanking(attribute: Attribute, measure: Measure, count: number): Filter;
|
|
307
616
|
/**
|
|
308
|
-
* Creates a filter
|
|
617
|
+
* Creates a filter to isolate items that rank towards the bottom for a given measure.
|
|
309
618
|
*
|
|
619
|
+
* @example
|
|
620
|
+
* Filter for age ranges with the bottom 3 lowest total revenue in the Sample ECommerce data model.
|
|
621
|
+
* ```ts
|
|
622
|
+
* filterFactory.bottomRanking(
|
|
623
|
+
* DM.Commerce.AgeRange,
|
|
624
|
+
* measures.sum(DM.Commerce.Revenue),
|
|
625
|
+
* 3
|
|
626
|
+
* )
|
|
627
|
+
* ```
|
|
310
628
|
* @param attribute - Attribute to filter
|
|
311
629
|
* @param measure - Measure to filter by
|
|
312
630
|
* @param count - Number of members to return
|
|
313
|
-
* @returns A filter
|
|
631
|
+
* @returns A filter instance
|
|
314
632
|
*/
|
|
315
633
|
export declare function bottomRanking(attribute: Attribute, measure: Measure, count: number): Filter;
|
|
316
634
|
/**
|
|
@@ -319,30 +637,64 @@ export declare function bottomRanking(attribute: Attribute, measure: Measure, co
|
|
|
319
637
|
* These operators are still in beta.
|
|
320
638
|
*
|
|
321
639
|
* @example
|
|
322
|
-
```
|
|
323
|
-
import { filters } from '@sisense/sdk-data';
|
|
324
|
-
|
|
325
|
-
// define filters
|
|
326
|
-
const revenueFilter =
|
|
327
|
-
const countryFilter =
|
|
328
|
-
const genderFilter =
|
|
329
|
-
const costFilter =
|
|
330
|
-
|
|
331
|
-
// create filter relation of two filters
|
|
332
|
-
const orFilerRelations = filterFactory.logic.or(revenueFilter, countryFilter);
|
|
333
|
-
// revenueFilter OR countryFilter
|
|
334
|
-
|
|
335
|
-
// filter relations can have nested filter relations
|
|
336
|
-
const mixedFilterRelations = filterFactory.logic.and(genderFilter, orFilerRelations);
|
|
337
|
-
// genderFilter AND (revenueFilter OR countryFilter)
|
|
338
|
-
|
|
339
|
-
// array, specified in filter relations, will be converted to an intersection of filters automatically
|
|
340
|
-
const arrayFilterRelations = filterFactory.logic.or([genderFilter, costFilter], mixedFilterRelations);
|
|
341
|
-
// (genderFilter AND costFilter) OR (genderFilter AND (revenueFilter OR countryFilter))
|
|
342
|
-
```
|
|
640
|
+
* ```ts
|
|
641
|
+
* import { filters } from '@sisense/sdk-data';
|
|
642
|
+
*
|
|
643
|
+
* // define filters
|
|
644
|
+
* const revenueFilter = filterFactory.greaterThan(DM.Commerce.Revenue, 1000);
|
|
645
|
+
* const countryFilter = filterFactory.members(DM.Commerce.Country, ['USA', 'Canada']);
|
|
646
|
+
* const genderFilter = filterFactory.doesntContain(DM.Commerce.Gender, 'Unspecified');
|
|
647
|
+
* const costFilter = filterFactory.between(DM.Commerce.Cost, 1000, 2000);
|
|
648
|
+
*
|
|
649
|
+
* // create filter relation of two filters
|
|
650
|
+
* const orFilerRelations = filterFactory.logic.or(revenueFilter, countryFilter);
|
|
651
|
+
* // revenueFilter OR countryFilter
|
|
652
|
+
*
|
|
653
|
+
* // filter relations can have nested filter relations
|
|
654
|
+
* const mixedFilterRelations = filterFactory.logic.and(genderFilter, orFilerRelations);
|
|
655
|
+
* // genderFilter AND (revenueFilter OR countryFilter)
|
|
656
|
+
*
|
|
657
|
+
* // array, specified in filter relations, will be converted to an intersection of filters automatically
|
|
658
|
+
* const arrayFilterRelations = filterFactory.logic.or([genderFilter, costFilter], mixedFilterRelations);
|
|
659
|
+
* // (genderFilter AND costFilter) OR (genderFilter AND (revenueFilter OR countryFilter))
|
|
660
|
+
* ```
|
|
343
661
|
* @beta
|
|
344
662
|
*/
|
|
345
663
|
export declare namespace logic {
|
|
664
|
+
/**
|
|
665
|
+
* Creates an 'AND' filter relation
|
|
666
|
+
*
|
|
667
|
+
* @example
|
|
668
|
+
* Create a filter relation for items that have a revenue greater than 100 and are in new condition
|
|
669
|
+
* in the Sample ECommerce data model.
|
|
670
|
+
* ```ts
|
|
671
|
+
* const revenueFilter = filterFactory.greaterThan(DM.Commerce.Revenue, 100);
|
|
672
|
+
* const conditionFilter = filterFactory.equals(DM.Commerce.Condition, 'New');
|
|
673
|
+
*
|
|
674
|
+
* const andFilerRelation = filterFactory.logic.and(revenueFilter, conditionFilter);
|
|
675
|
+
* ```
|
|
676
|
+
* @param left First filter or filter relation
|
|
677
|
+
* @param right Second filter or filter relation
|
|
678
|
+
* @returns A filter relation
|
|
679
|
+
* @beta
|
|
680
|
+
*/
|
|
346
681
|
const and: (left: FilterRelationNode, right: FilterRelationNode) => FilterRelation;
|
|
682
|
+
/**
|
|
683
|
+
* Creates an 'OR' filter relation
|
|
684
|
+
*
|
|
685
|
+
* @example
|
|
686
|
+
* Create a filter relation for items that have a revenue greater than 100 or are in new condition
|
|
687
|
+
* in the Sample ECommerce data model.
|
|
688
|
+
* ```ts
|
|
689
|
+
* const revenueFilter = filterFactory.greaterThan(DM.Commerce.Revenue, 100);
|
|
690
|
+
* const conditionFilter = filterFactory.equals(DM.Commerce.Condition, 'New');
|
|
691
|
+
*
|
|
692
|
+
* const orFilerRelation = filterFactory.logic.or(revenueFilter, conditionFilter);
|
|
693
|
+
* ```
|
|
694
|
+
* @param left First filter or filter relation
|
|
695
|
+
* @param right Second filter or filter relation
|
|
696
|
+
* @returns A filter relation
|
|
697
|
+
* @beta
|
|
698
|
+
*/
|
|
347
699
|
const or: (left: FilterRelationNode, right: FilterRelationNode) => FilterRelation;
|
|
348
700
|
}
|