@RandyHayes , I understand the formula you proposed, but it looks like I'm hitting delegation.
Example:
SQL Table Rows: ~4500
Function: (as you proposed)
ClearCollect(colLatestRecords,
ForAll(
GroupBy(
AddColumns(
'[dbo].[TABLE_NAME]',
"cDate",
timestamp
),
"equipmentID",
"_recs"
),
Patch(
First(SortByColumns(_recs, "cDate", Descending)),
{
equipmentID: equipmentID
}
)
)
)
Results: in a single record though there are many equipmentID's in the table (equipmentID is null though until ~ID 2500).
- "PowerApps encountered an error" message is because the field is blank (verified).
- I have AdvancedSettings/DataRowLimit at default 500
| ID | equipmentID | cdate |
| 500 | "Powerapps encountered an error" | 2/21/2021 0500 |
Delegation issue:
So I tried a Filter function on the SQL table like so (timestamp is a DATETIME(2) data type):
Set(varLookback, Now() - 1);
ClearCollect(colLatestRecords,
ForAll(
GroupBy(
AddColumns(
Filter(
'[dbo].[TABLE_NAME]',
timestamp > varLookback
),
"cDate",
timestamp
),
"equipmentID",
"_recs"
),
Patch(
First(SortByColumns(_recs, "cDate", Descending)),
{
equipmentID: equipmentID
}
)
)
)
But this always returns an empty collection. Shouldn't the dates in the timestamp column and varLookback be comparable in this case?