B2026 053 find unlinked values of selected #795

Merged
mschill merged 28 commits from B2026-053-Find-Unlinked-Values-of-Selected into Development 2026-07-30 15:29:20 -04:00
Owner
plarsen self-assigned this 2026-07-24 10:47:13 -04:00
djankowski was assigned by plarsen 2026-07-24 10:47:13 -04:00
jjenko was assigned by plarsen 2026-07-24 10:47:13 -04:00
mschill was assigned by plarsen 2026-07-24 10:47:13 -04:00
mvickers was assigned by plarsen 2026-07-24 10:47:13 -04:00
plarsen added 9 commits 2026-07-24 10:47:14 -04:00
plarsen requested review from jjenko 2026-07-24 10:47:31 -04:00
mschill requested changes 2026-07-24 11:04:54 -04:00
Dismissed
mschill left a comment
Owner

Likely shouldn't be changes to: ItemExt.cs, VlnFlexGrid.cs, VlnFlexGrid.Designer.cs, & DisplaySearch.Designer.cs

With the Tech debt project we will be changing every file in PROMS - thus we need to limit our changes to necessary ones to avoid unnecessary Merge Conflicts later on.

ItemExt.cs looks to only have spacing changes so shouldn't be included.
VlnFlexGrid.cs & VlnFlexGrid.Designer.cs appear relaed to another project.
DisplaySearch.Designer.cs - changes appear by accident by opening in the designer.

Likely shouldn't be changes to: ItemExt.cs, VlnFlexGrid.cs, VlnFlexGrid.Designer.cs, & DisplaySearch.Designer.cs With the Tech debt project we will be changing every file in PROMS - thus we need to limit our changes to necessary ones to avoid unnecessary Merge Conflicts later on. ItemExt.cs looks to only have spacing changes so shouldn't be included. VlnFlexGrid.cs & VlnFlexGrid.Designer.cs appear relaed to another project. DisplaySearch.Designer.cs - changes appear by accident by opening in the designer.
@@ -7279,6 +7279,7 @@ namespace VEPROMS.CSLA.Library
_ByWordSuffix = byWordSuffix;
}
}
Owner

Thinking this shouldn't be included for adding 1 blank line --- with the Tech debt project we will be changing every file in PROMS - thus we need to limit our changes to necessary ones to avoid unnecessary Merge Conflicts later on.

Thinking this shouldn't be included for adding 1 blank line --- with the Tech debt project we will be changing every file in PROMS - thus we need to limit our changes to necessary ones to avoid unnecessary Merge Conflicts later on.
mschill marked this conversation as resolved
@@ -2193,0 +2199,4 @@
if (match.Success) // Special case for percents.
{
int sl = SearchString.Length;
int precentIdx = SearchString.LastIndexOf('%');
Owner

What if multiple % signs? - like search for:
3% or 4% --- I believe the matches returned by the Regex object will give position of what is found.

What if multiple % signs? - like search for: 3% or 4% --- I believe the matches returned by the Regex object will give position of what is found.
mschill marked this conversation as resolved
@@ -2193,0 +2205,4 @@
{
ss = SearchString.Substring(startIndex, sl - 1);
var isNumeric = int.TryParse(ss, out int n);
if (isNumeric == true) // B2026-053 other that a % are the rest of the characters numbers.
Owner

With working on tech debt project --- moving forward need to follow suggested code practices / suggestions by SonarLint --- if (isNumeric == true) should be
if (isNumeric)

With working on tech debt project --- moving forward need to follow suggested code practices / suggestions by SonarLint --- if (isNumeric == true) should be if (isNumeric)
mschill marked this conversation as resolved
@@ -2193,0 +2207,4 @@
var isNumeric = int.TryParse(ss, out int n);
if (isNumeric == true) // B2026-053 other that a % are the rest of the characters numbers.
{
ss = ' ' + SearchString + ' '; // to get exact match add spaces before and after search string.
Owner

With working on technical debt - should avoid concatenating strings & use string interpolation instead.

With working on technical debt - should avoid concatenating strings & use string interpolation instead.
mschill marked this conversation as resolved
@@ -2193,0 +2211,4 @@
}
else
{
ss = ' ' + SearchString + ' '; // string it not a percent.
Owner

With working on technical debt - should avoid concatenating strings & use string interpolation instead.

With working on technical debt - should avoid concatenating strings & use string interpolation instead.
mschill marked this conversation as resolved
@@ -2193,0 +2221,4 @@
int strIdx2 = 0;
if (strl2 == prcIdx2 + 1) // if the last char is ' ' the last char.
{
ss = ' ' + SearchString; //B2026-053 add a space prefix to make the search exact. If search is 5% this makes it excult 25% 55% etc.;
Owner

With working on technical debt - should avoid concatenating strings & use string interpolation instead.

With working on technical debt - should avoid concatenating strings & use string interpolation instead.
mschill marked this conversation as resolved
@@ -2193,0 +2225,4 @@
}
else
{
ss = ' ' + SearchString + ' '; // Exact match add spaces before and after search string.
Owner

With working on technical debt - should avoid concatenating strings & use string interpolation instead.

With working on technical debt - should avoid concatenating strings & use string interpolation instead.
mschill marked this conversation as resolved
@@ -2193,0 +2231,4 @@
}
else
{
ss = ' ' + SearchString + ' '; // Exact match add spaces before and after search string.
Owner

With working on technical debt - should avoid concatenating strings & use string interpolation instead.

With working on technical debt - should avoid concatenating strings & use string interpolation instead.
mschill marked this conversation as resolved
jjenko requested changes 2026-07-24 11:48:44 -04:00
Dismissed
jjenko left a comment
Owner

I think there is a mis-understanding on what the B2026-053 was asking to be fixed.
It was to generically find only exact matches of ANY RO return value.

The % statement was just an example showing how, the search results gets cluttered with "matches" that are of no interest to the user.

B2026-053 text:

"Performing a referenced object global search for a particular value with the "Find Unlinked Values of Selected" option check should not return partial matches."

I think there is a mis-understanding on what the B2026-053 was asking to be fixed. It was to generically find only exact matches of ANY RO return value. The % statement was just an example showing how, the search results gets cluttered with "matches" that are of no interest to the user. B2026-053 text: "Performing a referenced object global search for a particular value with the "Find Unlinked Values of Selected" option check should not return partial matches."
plarsen added 1 commit 2026-07-27 11:10:57 -04:00
plarsen added 4 commits 2026-07-27 11:25:17 -04:00
plarsen added 1 commit 2026-07-27 11:32:19 -04:00
plarsen added 1 commit 2026-07-27 12:12:25 -04:00
plarsen added 1 commit 2026-07-27 12:22:23 -04:00
plarsen added 1 commit 2026-07-27 13:41:58 -04:00
mschill requested changes 2026-07-28 06:33:15 -04:00
Dismissed
mschill left a comment
Owner

VlnFlexGrid.Designer.cs should not be included --- looks like there were spacing changes.
Should there be any changes to DisplaySearch.Designer.cs? --- I thought we were just changing how the search behaved, not anything visually on the form? --- if there were no UI changes, this probably shouldn't have changes also.

Also - branch needed updated - I updated it but you will have to pull it down locally before making further changes/fixes.

VlnFlexGrid.Designer.cs should not be included --- looks like there were spacing changes. Should there be any changes to DisplaySearch.Designer.cs? --- I thought we were just changing how the search behaved, not anything visually on the form? --- if there were no UI changes, this probably shouldn't have changes also. Also - branch needed updated - I updated it but you will have to pull it down locally before making further changes/fixes.
mschill added 1 commit 2026-07-28 06:34:11 -04:00
plarsen added 1 commit 2026-07-28 10:54:41 -04:00
jjenko requested changes 2026-07-28 11:04:04 -04:00
Dismissed
jjenko left a comment
Owner

by always adding a space before the search text, it will not find places where the unlinked RO Value is the first thing on the line. Ex. an Equipment List might have only the unlinked RO Value.

I noticed that the last two fields in the call to GetListFromTextSearch() are for a "by word" text search and passes in a Regx expression. Could that be used? - look for "if (cbxByWord.Checked)"

by always adding a space before the search text, it will not find places where the unlinked RO Value is the first thing on the line. Ex. an Equipment List might have only the unlinked RO Value. I noticed that the last two fields in the call to GetListFromTextSearch() are for a "by word" text search and passes in a Regx expression. Could that be used? - look for "if (cbxByWord.Checked)"
@@ -2190,6 +2191,25 @@ namespace Volian.Controls.Library
OnSearchComplete(new DisplaySearchEventArgs(TimeSpan.FromTicks(DateTime.Now.Ticks - start.Ticks)));
}
private string exactsearch(string SearchString) // B2026-053
Owner

by always adding a space before the search text, it will not find places where the unlinked RO Value is the first thing on the line. Ex. an Equipment List might have only the unlinked RO Value.

I noticed that the last two fields in the call to GetListFromTextSearch() are for a "by word" text search and passes in a Regx expression. Could that be used? - look for "if (cbxByWord.Checked)"

by always adding a space before the search text, it will not find places where the unlinked RO Value is the first thing on the line. Ex. an Equipment List might have only the unlinked RO Value. I noticed that the last two fields in the call to GetListFromTextSearch() are for a "by word" text search and passes in a Regx expression. Could that be used? - look for "if (cbxByWord.Checked)"
jjenko marked this conversation as resolved
plarsen added 1 commit 2026-07-28 15:34:21 -04:00
plarsen added 1 commit 2026-07-28 15:42:54 -04:00
plarsen added 1 commit 2026-07-28 15:43:21 -04:00
mschill requested changes 2026-07-29 05:55:57 -04:00
Dismissed
mschill left a comment
Owner

See Note Regarding Regex performance

See Note Regarding Regex performance
@@ -2083,0 +2081,4 @@
string byWordPrefix = string.Empty;
string byWordSuffix = string.Empty;
if (Regex.IsMatch(ROSearchList, @"^[\d\.]")) // starts with a number or '.' decimal pt
Owner

lines 2092 - 2099 - the setting of ByWordPrefeix and ByWordSuffixL

Regexes are very hard on applications performance wise --- If just want to determine if a string ends in a Number, can't you use something like:

char.IsNumber(ROSearchList, ROSearchList.Length - 1);
char.IsLetter(ROSearchList, ROSearchList.Length - 1);
char.IsNumber(ROSearchList, 0);
char.IsLetter(ROSearchList, 0);

There are also functions like char.IsDigit if needed.

Obviously, you would need to 1st check that temp.Length > 0

Side question - if all we are doing is adding a regex prefix/suffix onto the checking code --- could we end up with stuff like 3.5 matching 3.52 since both end in a number and contain 3.5 ? -- You may be able to do something like pull back all the matches and then use LINQ to filter the list to ones that either end with the match or contain a space/bracket/parenthesis/punctuation after the match .

lines 2092 - 2099 - the setting of ByWordPrefeix and ByWordSuffixL Regexes are very hard on applications performance wise --- If just want to determine if a string ends in a Number, can't you use something like: char.IsNumber(ROSearchList, ROSearchList.Length - 1); char.IsLetter(ROSearchList, ROSearchList.Length - 1); char.IsNumber(ROSearchList, 0); char.IsLetter(ROSearchList, 0); There are also functions like char.IsDigit if needed. Obviously, you would need to 1st check that temp.Length > 0 Side question - if all we are doing is adding a regex prefix/suffix onto the checking code --- could we end up with stuff like 3.5 matching 3.52 since both end in a number and contain 3.5 ? -- You may be able to do something like pull back all the matches and then use LINQ to filter the list to ones that either end with the match or contain a space/bracket/parenthesis/punctuation after the match .
Owner

Matt,
I don't know if this makes any difference, but the byWordPrex and byWordSuffix strings get passed to a SQL stored procedure.

That same code is used above this code block for doing a By Word text search. I was going to suggest that instead of copying the code, to make it it's own function and call it in the two places.

Matt, I don't know if this makes any difference, but the byWordPrex and byWordSuffix strings get passed to a SQL stored procedure. That same code is used above this code block for doing a By Word text search. I was going to suggest that instead of copying the code, to make it it's own function and call it in the two places.
Owner

Would agree - if it is repeated code / a repeated idea - better to make it it's own function. That being said, while regexes are necessary in some places, any place that it works where we can replace a call with function calls like char.IsNumeric, it will benefit performance,

Would agree - if it is repeated code / a repeated idea - better to make it it's own function. That being said, while regexes are necessary in some places, any place that it works where we can replace a call with function calls like char.IsNumeric, it will benefit performance,
plarsen added 1 commit 2026-07-29 12:31:35 -04:00
mschill requested changes 2026-07-29 13:35:09 -04:00
Dismissed
mschill left a comment
Owner

Previous comments regarding Regexes still apply -- also it appears now we have 2 variables that we declared but did not use in string byWordPrefix & string byWordSuffix

Previous comments regarding Regexes still apply -- also it appears now we have 2 variables that we declared but did not use in string byWordPrefix & string byWordSuffix
@@ -2192,1 +2182,4 @@
Dictionary<string, string> settings = new Dictionary<string, string>();
string byWordPrefix = string.Empty;
Owner

Previous comments regarding Regexes still apply -- also it appears now we have 2 variables that we declared but did not use in string byWordPrefix & string byWordSuffix

Previous comments regarding Regexes still apply -- also it appears now we have 2 variables that we declared but did not use in string byWordPrefix & string byWordSuffix
Author
Owner

I removed the two unneeded variable declarations. I used what was previous used for the regex string. If you notice both tests are looking to see what the first character is and not the whole searchstring and from that it selects different regex strings. On account of this I am not sure char.IsNumeric will work because there are searchstrings that start with a number but are a mix of numbers and characters. Example 5% code: "if (Regex.IsMatch(ss, @"^[\d.]")) // starts with a number or '.' decimal pt"

I removed the two unneeded variable declarations. I used what was previous used for the regex string. If you notice both tests are looking to see what the first character is and not the whole searchstring and from that it selects different regex strings. On account of this I am not sure char.IsNumeric will work because there are searchstrings that start with a number but are a mix of numbers and characters. Example 5% code: "if (Regex.IsMatch(ss, @"^[\d\.]")) // starts with a number or '.' decimal pt"
mschill marked this conversation as resolved
plarsen added 1 commit 2026-07-29 13:44:44 -04:00
plarsen added 1 commit 2026-07-30 12:48:07 -04:00
jjenko requested changes 2026-07-30 14:02:20 -04:00
Dismissed
@@ -2046,0 +2020,4 @@
//if (cbxByWord.Checked)
//{
// // Generate a prefix & suffix to be used in the sql query around the search string.
Owner

Please move this descriptive comment (the stuff inside the curly braces) into the function you had created.

Then remove the rest of the stuff you had commented out.

Please move this descriptive comment (the stuff inside the curly braces) into the function you had created. Then remove the rest of the stuff you had commented out.
jjenko marked this conversation as resolved
@@ -2191,1 +2175,4 @@
}
private string GetByWordSettings(string ss, bool checkstart)
{
//if (Regex.IsMatch(ss, @"^[\d\.]")) // starts with a number or '.' decimal pt
Owner

Please remove the code you had commented out.

Please remove the code you had commented out.
jjenko marked this conversation as resolved
mschill requested changes 2026-07-30 14:09:46 -04:00
Dismissed
mschill left a comment
Owner

Need to look at comments --- what is commented out code and should be removed & where non-code comments should be moved to.

Also, noticed
if (cbxByWord.Checked)
was commented out - does that change some of the purpose for that code?

In testing doc would be sure to include testing for both searches & if cbxByWord is checked / unchecked.

Need to look at comments --- what is commented out code and should be removed & where non-code comments should be moved to. Also, noticed if (cbxByWord.Checked) was commented out - does that change some of the purpose for that code? In testing doc would be sure to include testing for both searches & if cbxByWord is checked / unchecked.
@@ -2044,2 +2020,2 @@
}
}
//if (cbxByWord.Checked)
Owner

Was this if intentionally commented out? -- just checking since doesn't it change the logic around this other search --- for testing would make sure both searches tested with the different options.

Was this if intentionally commented out? -- just checking since doesn't it change the logic around this other search --- for testing would make sure both searches tested with the different options.
Author
Owner

Thanks, that code needs to be there and account of that I need to change the logic for updating the pre and post additions.

Thanks, that code needs to be there and account of that I need to change the logic for updating the pre and post additions.
plarsen added 1 commit 2026-07-30 15:21:09 -04:00
jjenko approved these changes 2026-07-30 15:25:31 -04:00
jjenko left a comment
Owner

I'm good with the changes

I'm good with the changes
mschill approved these changes 2026-07-30 15:27:46 -04:00
mschill left a comment
Owner

Looks Good. Ready For QA.

Looks Good. Ready For QA.
mschill added 1 commit 2026-07-30 15:27:54 -04:00
mschill merged commit 3bb8fff3a1 into Development 2026-07-30 15:29:20 -04:00
Sign in to join this conversation.
No Reviewers
No Label
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Volian/SourceCode#795