Is there a way to have a tracker default to CONTAINS?

Hello,

I am building a dashboard that lets an employee search in part description for part names. They would like to be able to search for partial names and pull data.

I have the tracker set to MATCHES and I can do that by adding % to both sides of the part name.

My question is: Is there a way to have this tracker do a CONTAINS? Example would be to prepend and append % automatically where they don’t see it.

Any ideas?

You would have to create a Menu Level Customization and then hide your original textbox and create a new one and add an Event when the Text Changed to populate the hidden textbox with % and the value.

Example:

this.txtCalculated_Hierarchy = ((EpiTextBox)csm.GetNativeControlReference("3c3bf3db-bfa3-424e-b5a2-2b9cc3e51938"));
this.lblCalculated_Hierarchy = ((EpiLabel)csm.GetNativeControlReference("9ab7bdb4-7af6-45df-88d2-1b59530a97fb"));
this.txtCalculated_Hierarchy.Hide();
this.lblCalculated_Hierarchy.Hide();
this.txtJobNumProxy.TextChanged += new System.EventHandler(this.txtJobNumProxy_TextChanged);
private void txtJobNumProxy_TextChanged(object sender, System.EventArgs args)
{
	// ** Place Event Handling Code Here **
	if (txtJobNumProxy.Text != string.Empty)
	{
		txtCalculated_Hierarchy.Text = @"*\" + txtJobNumProxy.Text + @"\*";
	}
	else {
		txtCalculated_Hierarchy.Text = "";
	}
	
}
1 Like

Hello @hkeric.wci,

Can you explain the code a bit to me?

I tried plugging it in directly and changing the GUID to match my existing fields but I get errors.

Do I put your first part under the InitializeCustomCode() part?

If so, I get these errors:

rror: CS1061 - line 34 (156) - ‘Script’ does not contain a definition for ‘txtCalculated_Hierarchy’ and no extension method ‘txtCalculated_Hierarchy’ accepting a first argument of type ‘Script’ could be found (are you missing a using directive or an assembly reference?)
Error: CS1061 - line 36 (158) - ‘Script’ does not contain a definition for ‘txtCalculated_Hierarchy’ and no extension method ‘txtCalculated_Hierarchy’ accepting a first argument of type ‘Script’ could be found (are you missing a using directive or an assembly reference?)
Error: CS1061 - line 38 (160) - ‘Script’ does not contain a definition for ‘txtJobNumProxy’ and no extension method ‘txtJobNumProxy’ accepting a first argument of type ‘Script’ could be found (are you missing a using directive or an assembly reference?)
Error: CS0103 - line 62 (184) - The name ‘txtJobNumProxy’ does not exist in the current context
Error: CS0103 - line 64 (186) - The name ‘txtCalculated_Hierarchy’ does not exist in the current context
Error: CS0103 - line 64 (186) - The name ‘txtJobNumProxy’ does not exist in the current context
Error: CS0103 - line 67 (189) - The name ‘txtCalculated_Hierarchy’ does not exist in the current context

Hi Shawn,

We did this using an External Query. I am not sure why (maybe pure SQL vs BAQ SQL’ish?) is the reason it works. MATCHES PER BELOW makes the search work on partial text entry without user needing to add % or anything. We have UD field for “material code” info too, so that’s why I have a concatenated description calculated for Match on part desc or the UD desc too.

One drawback is that I use this as default part search. On part searches that are actually part rev search I needed to instruct users to click for base search.

Nancy

image

In a customized dashboard I use the code from this post to filter by partial match

@LBARKER

I followed your video and modified it a bit to get what I needed. Couldn’t have done it without your help!

I appreciate it!

Thanks,

Shawn