I am looking for help with a script to display only todays data unless todays data has not been displayed yet. If that is the case display yesterday data.
I am thinking it would be if today > 0 display today data if not display today-1
@jcarlson
Thank you for your continued help on this.
I am not sure the "AND" is the issue. I added the change and this is what I get. I think the problem is that the "filt" var is defined but then not put into the result. I would think that the "sorted" var would need to reference the "filt" var at some point.
I edited my reply below, but I think we want an "AND" in the SQL statement, not "OR". Something that has a value of '', that is, an empty string, will still satisfy the "IS NOT NULL" condition, allowing it through. My mistake!
You need an "AND" before the second statement in your SQL.
"...IS NOT NULL AND REEDER_Percent_FULL..."
EDIT: Change that to AND.
I am now getting data to display but it is still showing the Null data. How does the var filt apply to the sorted layer?
// Filter records with empty values (future dates) var filt = Filter(fs, "REEDER_Percent_FULL IS NOT NULL REEDER_Percent_FULL <> ''") // Sort filtered records for most recent first var sorted = OrderBy(fs, "Date_ DESC") // Return top record return First(sorted)
This is what I have so far.
I am getting this error:
Execution Error:Expected "*", "+", "-", "/", "AND", "OR", [ \t\n\r], or end of input but "R" found.
Thanks for the link.
One issue I have is that I have pre added dates for the year so I cannot pick the max date but maybe I can get it to work with todays date.
Ah, well that's not too bad. It's very similar to the example shown here.
// Get layer var portal = Portal('org-url') var fs = FeatureSetByPortalItem( portal, 'itemID', 0, // or whatever the layer index [ 'your', 'fields', 'some_date_field' ], false ); // Get most recent date, convert to SQL-compatible string var maxDate = Text(Date(fs, 'some_date_field'), 'YYYY-MM-DD'); // Return records for max date return Filter(fs, "some_date_field = @maxDate")
I am trying to do this in a data expression.
Are you doing this in a data expression? Or working with an existing layer? The former is possible, but the latter probably isn't.
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.