Hi, i need to get the maximum and minimum number of related products on project according to a decimal field using any help?
the below code is not setting the true max number and not setting the min value:
foreach (var RelatedProductsRecords in RelatedProductsEntity.Entities) { var Total= RelatedProductsRecords .GetAttributeValue<decimal>("new_totalarea"); log.Info("prod Size= " + Total); decimal highestFound = decimal.MaxValue; log.Info("highestFound= " + decimal.MaxValue); decimal lowestFound = decimal.MinValue; log.Info("lowestFound= " + decimal.MinValue); if (Total> highestFound) { highestFound = TotalCoveredArea; log.Info("Maximum pro Size= " + Total); ProjectEntity.Attributes["new_sizetorange"] = highestFound; log.Info("product size To = " + highestFound); service.Update(ProjectEntity); } if (Total< lowestFound) { lowestFound = Total; log.Info("Minimum Apartment Size= " + Total); ProjectEntity.Attributes["new_sizefromrange"] = lowestFound; log.Info("product size from = " + lowestFound); service.Update(ProjectEntity); }
}