NegativeKeywordListSelector

Contains the methods for filtering and ordering negative keywords lists. For information about selectors, see Selectors.

Example usage:

    var iterator = AdsApp.negativeKeywordLists()
        .withCondition("MemberCount > 10")
        .orderBy("Name")
        .get();

    while (iterator.hasNext()) {
        var nkwList = iterator.next();
    }

Methods

Method Name Return Type Description
get NegativeKeywordListIterator Gets an iterator used to iterate through the list of negative keywords lists.
orderBy(string orderBy) NegativeKeywordListSelector Applies the specified ordering to the selected negative keywords lists.
withCondition(string condition) NegativeKeywordListSelector Applies filter criteria to the negative keywords lists.
withIds(string[] ids) NegativeKeywordListSelector Gets negative keywords lists with the specified IDs.
withLimit(int limit) NegativeKeywordListSelector Gets the top n negative keywords lists that match the selection criteria.

get

Gets an iterator uses to iterate through the list of negative keywords lists.

Returns

Type Description
NegativeKeywordListIterator An iterator used to iterate through the negative keywords lists.

orderBy(string orderBy)

Applies the specified ordering to the selected negative keywords lists.

Specify the orderBy parameter in the form, "columnName orderDirection" where:

  • columnName is one of the supported columns
  • orderDirection is the order to sort the results in. Set to ASC to order the results in ascending order or DESC to order the results in descending order. The default is ASC.

For example, the following call returns negative keywords lists in ascending order by MemberCount.

selector = selector.orderBy("MemberCount");

Selectors support ordering entities by one field only. You may not order the list of entities by field x, and within x by field y, and so on. If you specify more than one orderBy() call in a chain or in separate selector calls, Scripts orders the list of entities using the field specified in the last orderBy() call. 

Arguments

Name Type Description
orderBy string The ordering to apply.

Returns

Type Description
NegativeKeywordListSelector Selector with ordering applied.

withCondition(string condition)

Applies filter criteria to the negative keywords lists.

Specify the condition parameter in the form, "columnName operator value" where:

Operators

The operator that you use depends on the column's type. Operators are case-sensitive. For example, use STARTS_WITH instead of starts_with.

Operators for columns that contain integers and long values:

<
<=
>
>=
=
!=

Operators for columns that contain double values:

<
>

Operators for columns that contain string values:

=
!=
STARTS_WITH
STARTS_WITH_IGNORE_CASE
CONTAINS
CONTAINS_IGNORE_CASE
DOES_NOT_CONTAIN
DOES_NOT_CONTAIN_IGNORE_CASE

Operators for columns that contain enumeration values:

=
!=
IN []
NOT_IN []

Operators for columns that contain an array of strings:

CONTAINS_ALL
CONTAINS_ANY
CONTAINS_NONE

Supported Columns. The column names are case sensitive.

Column Type Example
MemberCount int The number of negative keywords in the list.

withCondition("MemberCount > 10")
Name string The negative keyword list's name.

withCondition("Name = 'LIST NAME GOES HERE'")
ReferenceCount int The number of campaigns the list is associated with.

withCondition("ReferenceCount > 10")
SharedSetId double The ID of a negative keyword list. If you simply use this for equality comparison, consider using the withIds method instead.

withCondition("SharedSetId = 123456789")

Arguments

Name Type Description
condition string The condition to add to the selector.

Returns

Type Description
NegativeKeywordListSelector Selector with the condition applied.

withIds(string[] ids)

Gets negative keywords lists with the specified IDs.

You may apply one or more conditions to a selector. A chain of conditions is considered an AND operation. For example, the entity is selected only if condition A is true AND condition B is true. For example, the following call selects only negative keywords list 33333.

AdsApp.negativeKeywordLists()
    .withIds(['11111', '22222', '33333'])
    .withIds(['33333', '44444', '55555']);

Arguments

Name Type Description
ids string[] An array of negative keyword lists IDs. For limits, see Script execution limits.

Returns

Type Description
NegativeKeywordListSelector Selector with the IDs applied.

withLimit(int limit)

Gets the top n negative keywords lists that match the selection criteria.

Arguments

Name Type Description
limit int The number of negative keywords lists to return. The actual number may be less.

Returns

Type Description
NegativeKeywordListSelector Selector with limit applied.

See also