private function dateLabel(fullfieldname:String):Function { return function (item:Object, column:DataGridColumn):String { var dateFormatter:DateFormatter = new DateFormatter (); dateFormatter.formatString = "MM/DD/YYYY"; return dateFormatter.format(new Date(item[fullfieldname])); }; }
Hi Harold,Thanks for this - it works great in the results data grid - can you suggest where the similar fix should go in the sample values? In the selction query builder interface, date values for a date field still appear as the UTC decimals.Thanks,Chris
private function getDistinctValues(array:Array, fieldName:String, fieldType:String=""):Array { //prepare result array var collection:ArrayCollection = new ArrayCollection(array); var distinctValuesCollection:ArrayCollection = new ArrayCollection(); //prepare a temp working array var tempPropertyArray:Array = []; //loop over all the objects in the collection for each (var object:Object in collection) { //get the value from the object var propertyValue:Object // check the data type, add '' quotes if needed. if (fieldType == 'esriFieldTypeString' || fieldType == 'esriFieldTypeGUID' ) { propertyValue = "'" + object[fieldName] + "'"; } else if(fieldType == 'esriFieldTypeDate') { var dateFormatter:DateFormatter = new DateFormatter (); dateFormatter.formatString = "MM/DD/YYYY"; propertyValue = "'" + dateFormatter.format(new Date(object[fieldName])) + "'"; } else { propertyValue = object[fieldName]; } //write the value as a property. If it exists it will be overwritten //which creates a distinct list tempPropertyArray[propertyValue] = true; }
Does anyone have a compiled fix for the date issue? it is showing some long number for the date??
This widget is a life saver! Thanks for posting the compiled version for 2.5. I'm still having a small problem querying dates. All the data for my viewer is in an ArcSDE database which automatically adds the time along with the date. When I use the widget and attempt to query a date it doesn't return any results because it needs a time (When I manually type in the time than it works). The widget doesn't bring up the dates with the time though in the list of unique values, only date alone. Is there a way to fix that or if anyone knows how to turn the time off in the date field that would work too.Thanks the great widget!-Heather
Same SDK - 4.1 and AGS 2.5 It has the Date and Time formatter, but I don't have time data available to test this out. Can you work with the uncompiled version? If you can't work with the uncompiled version and this version does not work for you, I can abstract out the Date Time formatter into the config file (probably the best solution anyway), but I can't get to that for a few days, Maybe Tues or Weds. Let me know if this at least helps
Ashlee - sorry to bother you - but did you get this problem with 'unique values' not showing up resolved? i am having the same issue since upgrading my flexviewer (to 2.3.1).Thanks,Caroline
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.