REF_ROWS() documentation

Refer to this REF_ROWS()

3X_0_4_040f703290dbc098b8e174ba661ee746ef1e0ce1.png

Should they beโ€ฆ? :

FILTER(โ€œOrder Detailsโ€, ([_THISROW].[Order ID] = [Order ID]))

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

Solved Solved
1 9 424
1 ACCEPTED SOLUTION

There is no difference. Your approach may offer more clarity to someone reading the expression, and therefore may be preferable.

View solution in original post

9 REPLIES 9

No, they are correct. [_THISROW] is the key value of the current record, and [Order ID] is the Ref type column in the Order Details Table.

OK I got it.

1.The Order table must be using record number as key column.

2.The expressions are used in the Order table itself (as being parent to the Order Details table).

My question came from the thought if the record number is not the key column of the Order table (practically is the orderโ€™s serial number of some format). I myself never use record number as key column for any tables.

There is no reason to think that.

Correct

Agreed, using _rownumber as a key is very rarely appropriate. But these expressions have nothing to do with _rownumber.

Iโ€™ve just seen [_THISROW] being alone without any following dot (.).

3X_0_4_040f703290dbc098b8e174ba661ee746ef1e0ce1.png

Also, ?how are they different from:

FILTER(โ€œOrder Detailsโ€, ([_THISROW].[Order ID] = [Order ID]))

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

There is no difference. Your approach may offer more clarity to someone reading the expression, and therefore may be preferable.

I played with SELECT SQL a lot, still be confused by the samples, let alone the new comers.

AppSheet expressions donโ€™t use SQL at all. Perhaps thatโ€™s contributing to your confusion?

Since AppSheet uses the name โ€˜SELECTโ€™ for this function. I believe thereโ€™re also others people moving from database world (more or less) theyโ€™d pair this function to what they familiar with, the SELECT statement (in all SQL counterparts), just like me because AppSheetโ€™s SELECT function shares some aspects like the SQL SELECT.

Anyhow your sample expressions for REF_ROWS() give clues to what I (we) might not fully understand in AppSheet architecture.

Your expressions assume that the parent Table has an [Order ID] column, and that it is set as the key column. The expressions in the document do not make those assumptions, and will still be equivalent to the REF_ROWS expression even if the parent Table has a different key column, because [_THISROW] always returns the key value.