You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
StatisticRecord.Statistics.Value always looks like a value like this 1/1/1970 12:40:57 AM on 1/1/1970
Ironically, StatisticType.Sum seems to work. Below is an example function that illustrates the problem with StatisticType.Maximum. Just pass it a Geodatabase
publicasyncTaskTestDateMax(Geodatabasegdb){foreach(vartingdb.GeodatabaseFeatureTables){if(t.LoadStatus!=LoadStatus.Loaded){awaitt.LoadAsync();}vardateFields=newList<Field>();//Get all the date fieldsforeach(varfint.Fields){if(f.FieldType==FieldType.Date){dateFields.Add(f);}}//If no date fields or records skip this tableif(dateFields.Count==0||t.NumberOfFeatures==0){continue;}System.Diagnostics.Debug.WriteLine($"Testing {t.TableName} with {t.NumberOfFeatures} features");varfieldToMax_Loop=newDictionary<Field,DateTimeOffset?>();//Manually (slowly) get the max for each date fieldvarqp=newQueryParameters();varfeatures=awaitt.QueryFeaturesAsync(qp);foreach(ArcGISFeaturefeatureinfeatures){if(feature.LoadStatus!=LoadStatus.Loaded){awaitfeature.LoadAsync();}foreach(varfindateFields){varvalue=(DateTimeOffset?)feature.GetAttributeValue(f);if(!fieldToMax_Loop.TryGetValue(f,outDateTimeOffset?currentValue)){fieldToMax_Loop[f]=value;}else{if(value>currentValue){fieldToMax_Loop[f]=value;}}}}//Now lets's try to use StatisticType.Maximum and log the differences.. HINT they all breakvarfieldToMax_StatisticTypeMaximum=newDictionary<Field,DateTimeOffset?>();intfieldsWrongCount=0;intfieldsOkCount=0;foreach(varfindateFields){varstatList=newList<StatisticDefinition>();stringstatFieldName="MaxOf"+f.Name;varsd=newStatisticDefinition(f.Name,StatisticType.Maximum,statFieldName);statList.Add(sd);varstatParams=newStatisticsQueryParameters(statList);vartableStats=awaitt.QueryStatisticsAsync(statParams).ConfigureAwait();varstatRecord=tableStats.First();varstatValue=(DateTimeOffset?)statRecord.Statistics[statFieldName];fieldToMax_StatisticTypeMaximum[f]=statValue;fieldToMax_Loop.TryGetValue(f,outDateTimeOffset?loopValue);if(loopValue!=null){if(loopValue!=statValue){//SHOULD NEVER GET TO THIS LINE OF CODE---BUT WE DOSystem.Diagnostics.Debug.WriteLine($"{t.TableName}.{f.Name} LoopMax={loopValue}, statMax={statValue}");fieldsWrongCount++;}else{fieldsOkCount++;}}}}}
The text was updated successfully, but these errors were encountered:
StatisticRecord.Statistics.Value always looks like a value like this 1/1/1970 12:40:57 AM on 1/1/1970
Ironically, StatisticType.Sum seems to work. Below is an example function that illustrates the problem with StatisticType.Maximum. Just pass it a Geodatabase
The text was updated successfully, but these errors were encountered: