Hi all,
I have a custom table in Dataverse and a Canvas App which is attempting to CountRows on the table. This is based in a Sandbox environment.
I saw this on the Power Apps Ideas pages which seems to indicate this is known behaviour. See also: CountRows function returning zero for DataVerse tables - Power Apps Canvas apps - Debajit's Power Ap.... I have now worked around this by using
CountIf (<Data Source>, true>)
However, I am now finding I have the same problem (of "out of date" data) again when trying to use 'Last' on the table. I want to get the value from a new record I have just patched to the table, but using Last is returning an 'out of date' data from a previous record on the table - hours later.
To hopefully make this easier to explain I've attached two screenshots. The first shows a Dataverse table that has records up to reference 'IO-09'. The second shows a very simple button in a Canvas App with OnSelect attempting to get the Last record in that table. Why is it returning an incorrect (out of date) value? At time of screenshots it was about 45 minutes since the two additional records, 08 and 09, were created, so it's not a 'lag' issue.
Further things I've tried, all of which did not make any difference:
1. I went to the Data pane in the Canvas App studio and 'refreshed' the Dataverse table connection.
2. I tried Refresh (Table Name) in the OnSelect on the button (per my diagram)
3. I tried setting the variable to Blank () before setting it with the 'Last' value (just to ensure the variable was truly blank/empty).
4. I went to the table in Dataverse and added a new row directly in the table (as opposed to adding the rows by Patching from the Canvas App).
I cannot see any reason for this behaviour and also don't expect it to be linked to the 'caching' issue in Developer environments because how else are we expected to develop solutions in Sandbox environments and have them suitably work before moving them up to production?
Any help would be very much appreciated, thank you.