public void Setup(ColumnInfo colInfo) { MobiusDataType mdtLow, mdtHigh; InSetup = true; ColInfo = colInfo; // save ref to colInfo Stats = colInfo.Rfld.GetStats(); ItemFilter.Properties.Minimum = 0; ItemFilter.Properties.Maximum = Stats.DistinctValueList.Count + 2 - 1; // (All) on left, (Blanks) on right ParsedSingleCriteria psc = MqlUtil.ParseSingleCriteria(ColInfo.Qc.SecondaryCriteria); // parse criteria ItemFilter.Value = 0; ValueLabel.Text = "(All)"; if (psc != null && psc.OpEnum == CompareOp.Eq && Stats.DistinctValueList.Count > 0) { MetaColumnType type = ColInfo.Mc.DataType; MobiusDataType lowVal = MobiusDataType.New(type, psc.Value); MobiusDataType highVal = MobiusDataType.New(type, psc.Value); if (MetaColumn.IsDecimalMetaColumnType(type)) { // adjust decimal comparison values by an epsilon double e = MobiusDataType.GetEpsilon(Stats.MaxValue.FormattedText); lowVal.NumericValue -= e; highVal.NumericValue += e; } for (int i1 = 0; i1 < Stats.DistinctValueList.Count; i1++) { MobiusDataType mdt = Stats.DistinctValueList[i1]; string fTxt = mdt.FormattedText; if (Lex.Eq(psc.Value, fTxt) || (mdt.CompareTo(lowVal) >= 0 && mdt.CompareTo(highVal) <= 0)) { ItemFilter.Value = i1 + 1; ValueLabel.Text = Stats.DistinctValueList[i1].FormattedText; break; } } } else if (psc != null && psc.OpEnum == CompareOp.IsNull) // (Blanks) { ItemFilter.Value = Stats.DistinctValueList.Count + 1; ValueLabel.Text = "(Blanks)"; } ItemFilter.Focus(); InSetup = false; return; }
public void Setup(ColumnInfo colInfo) { InSetup = true; ColInfo = colInfo; // save ref to colInfo QueryColumn qc = colInfo.Qc; Stats = colInfo.Rfld.GetStats(); RangeFilter.Properties.Minimum = 0; RangeFilter.Properties.Maximum = Stats.DistinctValueList.Count - 1; ParsedSingleCriteria psc = MqlUtil.ParseSingleCriteria(ColInfo.Qc.SecondaryCriteria); // parse criteria TrackBarRange tbr = new TrackBarRange(0, Stats.DistinctValueList.Count - 1); RangeFilter.Value = tbr; if (psc != null && psc.OpEnum == CompareOp.Between && Stats.DistinctValueList.Count > 0) // setup prev value { MetaColumnType type = ColInfo.Mc.DataType; MobiusDataType lowVal = MobiusDataType.New(type, psc.Value); MobiusDataType highVal = MobiusDataType.New(type, psc.Value2); if (MetaColumn.IsDecimalMetaColumnType(type)) { // adjust decimal comparison values by an epsilon double e = MobiusDataType.GetEpsilon(Stats.MaxValue.FormattedText); lowVal.NumericValue += e; highVal.NumericValue -= e; } int lowPos = -1; for (int i1 = 0; i1 < Stats.DistinctValueList.Count; i1++) { MobiusDataType mdt = Stats.DistinctValueList[i1]; string fTxt = mdt.FormattedText; if (mdt.CompareTo(lowVal) <= 0 || Lex.Eq(fTxt, psc.Value)) { lowPos = i1; } else { break; } } int highPos = -1; for (int i1 = Stats.DistinctValueList.Count - 1; i1 >= 0; i1--) { MobiusDataType mdt = Stats.DistinctValueList[i1]; string fTxt = mdt.FormattedText; if (mdt.CompareTo(highVal) >= 0 || Lex.Eq(fTxt, psc.Value2)) { highPos = i1; } else { break; } } if (lowPos >= 0 && highPos >= 0) { tbr = new TrackBarRange(lowPos, highPos); RangeFilter.Value = tbr; } } UpdateLabels(); RangeFilter.Focus(); InSetup = false; return; }