Hello.
I have table when log values for estate object statuses are stored (table โEstateObjectStatusesโ).
There are two statuses: โon saleโ and โnot on saleโ. Each row in โEstateObjectStatusesโ has timestamp (column โtimestampโ).
Estate objects are stored in table โEstateObjectsโ. There is column โcurrent_statusโ.
So, I need somehow keep value in โcurrent_statusโ as a selection of last status by timestamp for each object.
So I managed to get latest id by this expression:
MAXROW(
EstateObjectStatuses,
"timestamp",
([_THISROW].[estate_object_id] = [estate_object_id])
)
By this expression I get id from โEstateObjectStatusesโ (โestate_object_status_idโ column). But I need value of column โstatusโ!
MAXROW(
...
).[status]
Doesnโt work.
Iโve done it by this expression:
SELECT(
EstateObjectStatuses[status],
(
[estate_object_status_id] = MAXROW(
EstateObjectStatuses,
"timestamp",
([_THISROW].[estate_object_id] = [estate_object_id])
)
)
)
But is it correct?
Such a cumbersome expression for simple queryโฆ
MAXROW() returns a REF, so to retrieve the value of the [Status] column, you need to de-ref the valur. Set a VC with the MAXROW() expression only and then use this VC column for de-ref
[VirtualColumn].[Status]
OR
ANY(
SELECT(
EstateObjectStatuses[status],
[_RowNumber] =
MAX(
SELECT(
EstateObjectStatuses[_RowNumber],
[_THISROW].[estate_object_id] = [estate_object_id]
)
)
)
)
Yep, but thatโs how AppSheet worksโฆ
I can only suggest developers to take a look at Django ORM (sure they know but maybeโฆ)
User | Count |
---|---|
32 | |
31 | |
30 | |
19 | |
17 |