Selectors help the programmer construct the query that fetches requested
Google Ads entities. With selectors, one can narrow down the list of
retrieved entities and order it. Most selectors have the following
methods:

`withCondition()`
:   Adds a condition to a selector. If multiple conditions are used, they are
    AND-ed together, in other words, the selector will only return entities that
    satisfy **all** of the specified conditions.

`withIds()`
:   Adds a collection of [IDs](https://developers.google.com/google-ads/scripts/docs/elements/ids) as a
    condition. An ID-based condition will be AND-ed together with all the others.

`forDateRange()`
:   Is needed when a condition or ordering clause references a
    [Stats](https://developers.google.com/google-ads/scripts/docs/reference/adsapp/adsapp_stats) field, such as
    Ctr or Impressions. If you request all campaigns with over 100 impressions,
    Google Ads scripts will need to know the date range to look into.

`orderBy()`
:   Specifies the ordering of the returned entities.

`withLimit()`
:   Limits the number of returned entities to the specified value. It is
    particularly useful in conjunction with `orderBy()` in order to fetch things
    like "10 keywords with most impressions yesterday". By default, all selectors
    will set the limit to 50,000. You can increase the limit by manually specifying
    a limit.

These methods can be called in any order. One exception is `orderBy()`, where
order of calls indeed matters: multiple calls to this method will specify
multiple ordering clauses, and they will apply in order. Consider the
following snippet:

    selector = selector.forDateRange("LAST_14_DAYS")
        .orderBy("metrics.clicks DESC")
        .orderBy("metrics.ctr ASC");

The results will be ordered by Clicks in descending order. Results with equal
Clicks values will be ordered by Ctr in ascending order.

Calls to a selector's methods can be chained together. The following code

    var campaignSelector = AdsApp.campaigns();
    campaignSelector.withCondition("metrics.clicks > 10");
    campaignSelector.withCondition("metrics.impressions > 1000");
    campaignSelector.orderBy("metrics.impressions DESC");
    campaignSelector.forDateRange("YESTERDAY");

can be re-written in a more compact fashion:

    var campaignSelector = AdsApp.campaigns()
      .withCondition("metrics.clicks > 10")
      .withCondition("metrics.impressions > 1000")
      .orderBy("metrics.impressions DESC")
      .forDateRange("YESTERDAY");

Once the selector is constructed, one can obtain an
[Iterator](https://developers.google.com/google-ads/scripts/docs/elements/iterators) from it by calling
`selector.get()`.

> [!NOTE]
> **Note:** Some selectors (for example [`AdParamSelector`](https://developers.google.com/google-ads/scripts/docs/reference/adsapp/adsapp_adparamselector) and [`LabelSelector`](https://developers.google.com/google-ads/scripts/docs/reference/adsapp/adsapp_labelselector)) expose fewer methods since they operate on entities that are more restricted (don't have any stats or meaningful fields to order by).

Read [Best Practices](https://developers.google.com/google-ads/scripts/docs/best-practices) for tips
and tricks on efficient selector usage.