I am trying to figure out how to get the last edited feature to be the one filtered out.
This works for part of the day. There are just a few hours where it does not work. From 10am (local time) until I enter that days data. I usually enter new data midday. It does not pull in the last edited based on time. It pulls in based on date and when there are two from the same day it will pull the wrong feature.
I get No Value because it is pulling the wrong edit date.
var portal = Portal("https:///portal/"); var fs = FeatureSetByPortalItem( portal, "", 1, [ "Date_", "W_F_MGD", "E_F_MGD", "TOTAL_W_E_MGD", "TID_FLOW_MGD", "REEDER_Percent_FULL", "TAP_FLOW_MGD", "PLANT_PRODUCTION_MGD", "last_edited_date" ], false ); // Find the most recent date from the date field to filter the FeatureSet for the latest record var maxDate = Text(Date(ToLocal(Max(fs, 'last_edited_date'))),"YYYY-MM-DD"); return Filter(fs, "Date_ = @maxDate");
Can you just find the greatest difference in milliseconds between your UTC last-edited date and another arbitrary date?
var date1 = Date(2020, 1, 1, 1, 1, 1) var date2 = Now() return DateDiff(date2, date1)
Also you have 'Inputted' and 'Inputed', I'm not sure ieitheris the correct word as isn't that past tense? Possibly 'input' or 'entered'? Just my 5 cents.
I have fixed the typo thanks. My hope is that if I get this figured out I will not have to worry about which is correct because some data should always be displayed.
I do like the idea of getting the greatest difference. I just need to figure out how to apply it now.
I found a blog that has helped. I can sort by last edit date. I can also tell it to display only 1 record.