How can I select the most recent record from a list?
For getting the reference to the most recently created record in the same table, please refer to MAXROW() function described in the article below. The function returns the "Key " of the most recently created record.
help.appsheet.com - List Expressions and Aggregates List Expressions and Aggregates help.appsheet.com
If you are looking to get the most recent child record from a child record in a parent table for each parent record , then please refer to the sample app below
appsheet.com - Most Recent Child Row - This app shows how to get the most recent related row for a table Most Recent Child Row - This app shows how to get the most recent related row for a table appsheet.com
To get the row at the bottom of the spreadsheet, the row with the highest row number:
MAXROW(โTableNameโ, โ_ROWNUMBERโ)
replacing TableName with the name of your table.
If your table has a timestamp column (Timestamp), and you want the row with the most-recent timestamp:
MAXROW(โTableNameโ, โTimestampโ)
In this example, how do I select the largest dependent of the column condition, not the largest of all column values?
MAXROW(โChildโ, โTimestampโ, [_THISROW] = [Parent])
The example you provided will return the row of the Child table with the highest value in the Timestamp column from among only those rows where the Parent column value is equal to the current rowโs key column value. How is that not โthe largest dependent of the column conditionโ?
Hmmmmโฆ as a complete aside and note to @Steve: while the syntax above works, I can see now why people in the community are confused about when and where to use [_thisrow].
Usage like this is confusing to people that donโt have a foundation in relational databases; they understand that the object of a record is represented by a key value.
Something that Iโve found makes more sense to the general public is:
MAXROW(โChildโ, โTimestampโ, [Parent] = [_thisrow].[Key_Column])
In this example Iโve changed the way weโre calling the Key value for the record the formula is evaluating on; instead of saying to the system, โGive me the object that represents the record,โ weโre saying, โgive me the [Key_Column] value from [_thisrow]โ making use of the familiar de-reference syntax.
Just noticed the syntax in the app and two things clicked together - thought I would point it out.
Unfortunately, I was not successful, I do not get the error, but I can not get the result I want.
MAXROW(Child, checkin date, [_THISROW(add)]=[key].[add col.(b)])
not result:b
Can you help me?
Please provide a screenshot of the columns list for the Child table from the Data > Columns tab of the app editor.
Yeah, Iโm one of the ones that doesnโt get it. Where are we putting the MAXROW(โTableNameโ, โ_ROWNUMBERโ) expression? Iโve tried the _RowNumber column, security filter on the table, filter on the slice and filter view. No dice.
You must add the expression by adding a virtual column to the table you want to show. If you add a normal column you will need to update the table.
Please check here.
The MAXROW( table , col )
expression is technically a โwrapperโ for:
ANY(FILTER( table , [col] = MAX( table[col] ) ) )
That is why the error mentions the expression MAX()
.
Did you by chance change the Data Type of the _RowNumber column for your 2D Create Table?
Thanks, Marc.
I had and I switched it back, but Iโm still having difficulty. Maybe I need more coffeeโฆ
A tableโs security filter expression cannot reference itself; i.e., the security filter expression for the 2D Create table cannot reference the 2D Table. The expression can only reference other columns in the same row, or values from other tables.
I wish my brain would help a little.
User | Count |
---|---|
16 | |
10 | |
8 | |
5 | |
5 |