Notification

AppSheet will be conducting service maintenance starting Sunday, May 19th, 2024 at 12:00 PM (7:00 PM UTC) and completing no later than 4:00 PM PDT (11:00 PM UTC). Learn more

SELECT()

Select specific rows from a table or slice

Returns a list of values from the column of selected rows in the data set.

Sample usage

SELECT(Students[First Name], TRUE, FALSE) returns a list of first names (possibly with duplicates) of all students. Equivalent to SELECT(Students[First Name], TRUE).

SELECT(Students[First Name], ([Class of] = "2020"), FALSE) returns a list of first names (possibly with duplicates) of the students of the class of 2020. Equivalent to SELECT(Students[First Name], ([Class of] = "2020")).

SELECT(Students[First Name], ([Class of] = "2020"), TRUE) returns a list of distinct first names (duplicates omitted) of the students of the class of 2020.

SELECT(Orders[Order ID], ([Customer] = [_THISROW].[Customer])) returns the Order ID column values (the row keys) for rows in the Orders data set in which the Customer column value is equal to the Customer column value of the current form. 

SELECT(Products[Name], ([Price] < 100), TRUE) returns the distinct names of products priced less than $100.

Syntax

SELECT(from-dataset-column, select-row?, [distinct-only?])

  • dataset-column - The specification of the table or slice (the "data set") to search and the column from which values are to be gathered, in the form: dataset-name[column-name]. For example, Orders[Order ID]. Although identical in appearance to a column list expression, this argument is not an expression.
  • select-row? -  A Yes/No expression, evaluated for each row of the data set, that returns TRUE or FALSE indicating whether the column value from the row should be included (TRUE) or excluded (FALSE) in the results.
  • distinct-only? - A Yes/No expression. Set to FALSE to indicate the results list should include all values found in selected rows, or TRUE to indicate duplicate values should be omitted. If not given, FALSE is assumed.

Troubleshoot

Within the second argument, the select-row? expression, any column references are interpreted from the perspective of the data set being searched, not that of the data set from which the expression is run. In order to reference columns from the current row, you must dereference _THISROW.

For example, consider this attempt from an order row to get the item descriptions from the order detail rows:

SELECT(Order Details[Description], ([Order ID] = [Order ID]), TRUE)

The goal is to select rows from the Order Details data set with an Order ID column value that matches this order's own ID. But within the select-row? expression (([Order ID] = [Order ID])), both column references refer to the Order Details row being examined. As written, the expression will always be TRUE.

To reference a column of the current row, dereference _THISROW to get the desired column:

SELECT(Order Details[Description], ([Order ID] = [_THISROW].[Order ID]), TRUE)

See Also

FILTER()

LOOKUP()

MAXROW()

MINROW()

REF_ROWS()

Was this helpful?

How can we improve it?

Need more help?

Try these next steps:

true
Search
Clear search
Close search
Main menu
13049367782862377443
true
Search Help Center
true
true
true
false
false