MccApp.​AccountLabelSelector

Fetches account labels. Supports filtering.

Typical usage:

 var accountLabelSelector = MccApp.accountLabels()
     .withCondition("Name CONTAINS 'priority'");

 var accountLabelIterator = accountLabelSelector.get();
 while (accountLabelIterator.hasNext()) {
   var accountLabel = accountLabelIterator.next();
 }
Related:

Methods:

MemberTypeDescription
get MccApp.AccountLabelIterator Fetches the requested account labels and returns an iterator.
withCondition MccApp.AccountLabelSelector Adds the specified condition to the selector in order to narrow down the results.
withIds MccApp.AccountLabelSelector Restricts this selector to return only account labels with the given account label IDs.

get()

Fetches the requested account labels and returns an iterator.

Return values:

TypeDescription
MccApp.AccountLabelIterator Iterator of the requested account labels.

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:

 selector = selector
     .withCondition("Name CONTAINS 'PRIORITY'")
     .withCondition("Name DOES_NOT_CONTAIN 'FINISHED'");
All specified conditions are AND-ed together. The above example will retrieve labels whose name contains PRIORITY but doesn't contain FINISHED.

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 String columns (e.g. Name):
    =  !=  STARTS_WITH  STARTS_WITH_IGNORE_CASE
     CONTAINS  CONTAINS_IGNORE_CASE  DOES_NOT_CONTAIN  DOES_NOT_CONTAIN_IGNORE_CASE
Operators are case-sensitive: starts_with won't work.

Columns

All column names are case-sensitive.

Column Type Example
Name String withCondition("Name CONTAINS 'priority'")

Arguments:

NameTypeDescription
condition String Condition to add to the selector.

Return values:

TypeDescription
MccApp.AccountLabelSelector The selector with the condition applied.

withIds(ids)

Restricts this selector to return only account labels with the given account label IDs.
 var accountLabelIds = [12345, 23456, 34567];
 selector = selector.withIds(accountLabelIds);

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:

 MccApp.accountLabels()
    .withIds([12345, 23456, 34567])
    .withIds([34567, 45678, 56789]);
will only get the account label with ID 34567, since it would be the only account label 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:

NameTypeDescription
ids long[] Array of account label IDs.

Return values:

TypeDescription
MccApp.AccountLabelSelector The selector restricted to the given IDs.

发送以下问题的反馈:

此网页
AdWords Scripts
AdWords Scripts
需要帮助?请访问我们的支持页面