From 43b63e2843dd4c63ebcc3d4ee54a073d317f3245 Mon Sep 17 00:00:00 2001 From: Paul Larsen Date: Thu, 30 Jul 2026 12:51:24 -0400 Subject: [PATCH] B2026-053-Find-Unlinked-Values-of-Selected --- .../Volian.Controls.Library/DisplaySearch.cs | 78 +++++++++++++------ 1 file changed, 53 insertions(+), 25 deletions(-) diff --git a/PROMS/Volian.Controls.Library/DisplaySearch.cs b/PROMS/Volian.Controls.Library/DisplaySearch.cs index d96e172b..84b73d4d 100644 --- a/PROMS/Volian.Controls.Library/DisplaySearch.cs +++ b/PROMS/Volian.Controls.Library/DisplaySearch.cs @@ -2028,10 +2028,8 @@ namespace Volian.Controls.Library SearchString = TextSearchString; - Dictionary rtnByWord = GetByWordSettings(TextSearchString); - // B2022-031 - added a cbxProcSectSrch to filter out procedure and section titles from global search results. - SearchResults = ItemInfoList.GetListFromTextSearch(DVISearchList, TypeSearchList, TextSearchString /*.Replace(@"\",@"\u9586?")*/, cbxBooleanTxtSrch.Checked ? 2 : cbxCaseSensitive.Checked ? 1 : 0, cbxProcSectSrch.Checked ? 1 : 0, cbxIncROTextSrch.Checked ? ItemSearchIncludeLinks.Value : ItemSearchIncludeLinks.Nothing, includeRTFformat, includeSpecialChars, unitPrefix, rtnByWord["byWordPrefix"], rtnByWord["byWordSuffix"]); + SearchResults = ItemInfoList.GetListFromTextSearch(DVISearchList, TypeSearchList, TextSearchString /*.Replace(@"\",@"\u9586?")*/, cbxBooleanTxtSrch.Checked ? 2 : cbxCaseSensitive.Checked ? 1 : 0, cbxProcSectSrch.Checked ? 1 : 0, cbxIncROTextSrch.Checked ? ItemSearchIncludeLinks.Value : ItemSearchIncludeLinks.Nothing, includeRTFformat, includeSpecialChars, unitPrefix, GetByWordSettings(TextSearchString, true), GetByWordSettings(TextSearchString, false)); cmbResultsStyleIndex = 3; // display step text in results //} @@ -2065,9 +2063,7 @@ namespace Volian.Controls.Library if (cbxFndUnLnkROVals.Enabled && cbxFndUnLnkROVals.Checked) { - Dictionary rtnByWord = GetByWordSettings(ROSearchList); - - SearchResults = ItemInfoList.GetListFromTextSearch(DVISearchList, TypeSearchList, ROSearchList, cbxBooleanTxtSrch.Checked ? 2 : cbxCaseSensitive.Checked ? 1 : 0, cbxProcSectSrch.Checked ? 1 : 0, ItemSearchIncludeLinks.Nothing, includeRTFformat, includeSpecialChars, unitPrefix, rtnByWord["byWordPrefix"], rtnByWord["byWordSuffix"]); + SearchResults = ItemInfoList.GetListFromTextSearch(DVISearchList, TypeSearchList, ROSearchList, cbxBooleanTxtSrch.Checked ? 2 : cbxCaseSensitive.Checked ? 1 : 0, cbxProcSectSrch.Checked ? 1 : 0, ItemSearchIncludeLinks.Nothing, includeRTFformat, includeSpecialChars, unitPrefix, GetByWordSettings(ROSearchList, true), GetByWordSettings(ROSearchList, false)); cmbResultsStyleIndex = 3; // display step text in results } else @@ -2177,27 +2173,59 @@ namespace Volian.Controls.Library } OnSearchComplete(new DisplaySearchEventArgs(TimeSpan.FromTicks(DateTime.Now.Ticks - start.Ticks))); } - private Dictionary GetByWordSettings(string ss) + private string GetByWordSettings(string ss, bool checkstart) { - Dictionary settings = new Dictionary(); + //if (Regex.IsMatch(ss, @"^[\d\.]")) // starts with a number or '.' decimal pt + //{ + // settings.Add("byWordPrefix", @"[^0-9a-zA-Z.vbpi:\\-]"); + //} + //else if (Regex.IsMatch(ss, @"^[a-zA-Z]")) // starts with a letter + //{ + // settings.Add("byWordPrefix", @"[^a-zA-Z]"); + //} + //if (Regex.IsMatch(ss, @"^[\d\.]")) // ends with a number or decimal + //{ + // settings.Add("byWordSuffix", @"[^0-9a-zA-Z.vbpi:\\-]"); + //} + //else if (Regex.IsMatch(ss, @"[a-zA-Z]$")) // ends with a letter + //{ + // settings.Add("byWordSuffix", @"[^a-zA-Z]"); + //} + //return settings; + if (ss.Length > 0) + { + //checking start + if (checkstart) + { + // starts with a number or '.' decimal pt + if (char.IsNumber(ss, 0) || ss[0] == '.') + { + return @"[^0-9a-zA-Z.vbpi:\\-]"; + } + // starts with a letter + else if (char.IsLetter(ss, 0)) + { + return @"[^a-zA-Z]"; + } + } + //checking end + else + { + // ends with a number or '.' decimal pt + if (char.IsNumber(ss, ss.Length - 1) || ss[ss.Length - 1] == '.') + { + return @"[^0-9a-zA-Z.vbpi:\\-]"; + } + // ends with a letter + else if (char.IsLetter(ss, ss.Length - 1)) + { + return @"[^a-zA-Z]"; + } + } + } - if (Regex.IsMatch(ss, @"^[\d\.]")) // starts with a number or '.' decimal pt - { - settings.Add("byWordPrefix", @"[^0-9a-zA-Z.vbpi:\\-]"); - } - else if (Regex.IsMatch(ss, @"^[a-zA-Z]")) // starts with a letter - { - settings.Add("byWordPrefix", @"[^a-zA-Z]"); - } - if (Regex.IsMatch(ss, @"^[\d\.]")) // ends with a number or decimal - { - settings.Add("byWordSuffix", @"[^0-9a-zA-Z.vbpi:\\-]"); - } - else if (Regex.IsMatch(ss, @"[a-zA-Z]$")) // ends with a letter - { - settings.Add("byWordSuffix", @"[^a-zA-Z]"); - } - return settings; + //default + return string.Empty; } private void ClearResults() // B2021-103 if no results when RNO only, clear results list. (moved from btnSearch_Click) {