Fetches excluded placement lists. Supports filtering and sorting.
Typical usage:
var sharedExcludedPlacementSelector = AdsApp.excludedPlacementLists()
.withCondition("Name CONTAINS 'test'")
.withLimit(1)
.withIds([10,20])
.orderBy("SharedSetId DESC");
var sharedExcludedPlacementIterator = sharedExcludedPlacementSelector.get();
while (sharedExcludedPlacementIterator.hasNext()) {
var sharedExcludedPlacement = sharedExcludedPlacementIterator.next();
}
Methods:
get()
Fetches the requested excluded placement lists and returns an iterator.
Return values:
orderBy(orderBy)
Specifies the ordering of the resulting entities.
orderBy
parameter can have one of the
following forms:
orderBy("Name")
- orders results by Name, in ascending order.
orderBy("MemberCount ASC")
- orders results by MemberCount, in ascending order.
orderBy("Name DESC")
- orders results by Name, in descending order.
See ExcludedPlacementListSelector.withCondition(String) for enumeration of columns that can be used.
orderBy()
may be called multiple times. Consider the following example:
excludedPlacementListSelector = excludedPlacementListSelector
.orderBy("SharedSetId DESC");
The results will be ordered by SharedSetId in descending order.
Arguments:
Name | Type | Description |
orderBy |
String |
Ordering to apply. |
Return values:
withCondition(condition)
Adds the specified condition to the selector in order to narrow down the results.
Multiple conditions may be added to the same selector:
excludedPlacementListSelector = excludedPlacementListSelector
.withCondition("SharedSetId > 5")
.withCondition("Name CONTAINS 'excluded placement list'");
All specified conditions are
AND
-ed together. The above example will retrieve
excluded placement lists that have a Shared Set Id greater than 5 and contains
"excluded placement list" in its name.
The parameter to be passed into this method must be of the following form:
"COLUMN_NAME OPERATOR VALUE"
Operators
The operator that can be used in a condition depends on the type of column.
- For
Integer
and Long
columns (e.g. SharedSetId):
< <= > >= = !=
- For
String
columns (e.g. Name):
= != STARTS_WITH STARTS_WITH_IGNORE_CASE CONTAINS
CONTAINS_IGNORE_CASE DOES_NOT_CONTAIN DOES_NOT_CONTAIN_IGNORE_CASE
- For
Enumeration
columns (ones that can only take one value from a predefined
list, such as Status):
= != IN [] NOT_IN []
Conditions using
IN
,
NOT_IN
,
CONTAINS_ALL
,
CONTAINS_ANY
and
CONTAINS_NONE
operators look as follows:
withCondition("Name IN [Value1, Value2]")
Operators are case-sensitive:
starts_with
won't work.
Columns
All column names are case-sensitive, and so are all values of enumerated columns (such as
Status).
Column |
Type |
Example |
Shared Set Attributes |
MemberCount |
Integer |
withCondition("MemberCount > 5") |
Name |
String |
withCondition("Name = 'excluded placement list'") |
ReferenceCount |
Integer |
withCondition("ReferenceCount> 5") |
SharedSetId |
Long |
withCondition("SharedSetId > 5") |
Status |
Enumeration: ACTIVE , DELETED |
withCondition("Status = ACTIVE") |
Arguments:
Name | Type | Description |
condition |
String |
Condition to add to the selector. |
Return values:
withIds(ids)
Restricts this selector to return only excluded placement lists with the given
excluded placement list IDs.
var excludedPlacementListIds = [12345, 23456, 34567];
selector = selector.withIds(excludedPlacementListIds);
The resulting selector can be further refined by applying additional conditions to it. The
ID-based condition will then be AND-ed together with all the other conditions, including any
other ID-based conditions. So, for instance, the following selector:
AdsApp.excludedPlacementLists()
.withIds([12345, 23456, 34567])
.withIds([34567, 45678, 56789]);
will only get the excluded placement list with ID
34567
, since it would be the only
excluded placement list that satisfies both ID conditions.
The selector can only support up to 10,000 IDs. If more than 10,000 IDs are specified, the
corresponding get() call will fail with a runtime error.
Arguments:
Name | Type | Description |
ids |
long[] |
Array of excluded placement list IDs. |
Return values:
withLimit(limit)
Specifies limit for the selector to use. For instance,
withLimit(50)
returns only the
first 50 entities.
Arguments:
Name | Type | Description |
limit |
int |
How many entities to return. |
Return values: