Can we change a Combo box to "contains" rather than "Starts with"

On a classic dashboard grid, one of the fields is a drop down list fed by a BAQ. If the user starts typing in the field then it narrows the list down to choices that “start with” what they have typed. Is it possible to narrow it down to choices that “contain” what they have typed?

Is it possible to do it in Kinetic?

I have done something similar using the wherelist on the grid control in Kinetic

Under Properties → Grid Model → Provider Model → BAQ Options → WhereList

Column
OrderHead_PONum

Condition
like

Value
‘?{TransView.PONum}%’

My example works as a starts operator but ff you put a % before the ? it might just work as a contains.

Like
‘%?{TransView.PONum}%’

2 Likes

To add for more clarity since I also use this ‘where’ field quite often.

The following is from a helper function where I pass the outputFilter string directly into the ‘Where’ column:

var filters = new StringBuilder();  // Start with an empty string

if (filterLaser) filters.Append("JobOpDtl_OpDtlDesc LIKE '%Laser%'");
if (filterNakamura) filters.Append(filters.Length > 0 ? " OR JobOpDtl_OpDtlDesc LIKE '%Nakamura%'" : "JobOpDtl_OpDtlDesc LIKE '%Nakamura%'");
if (filterDoosan) filters.Append(filters.Length > 0 ? " OR JobOpDtl_OpDtlDesc LIKE '%Doosan%'" : "JobOpDtl_OpDtlDesc LIKE '%Doosan%'");
if (filterBand) filters.Append(filters.Length > 0 ? " OR JobOpDtl_OpDtlDesc LIKE '%Band%'" : "JobOpDtl_OpDtlDesc LIKE '%Band%'");
if (filterManual) filters.Append(filters.Length > 0 ? " OR JobOpDtl_OpDtlDesc LIKE '%Manual%'" : "JobOpDtl_OpDtlDesc LIKE '%Manual%'");
if (filterCitizen) filters.Append(filters.Length > 0 ? " OR JobOpDtl_OpDtlDesc LIKE '%Citizen%'" : "JobOpDtl_OpDtlDesc LIKE '%Citizen%'");
if (filterMiyano) filters.Append(filters.Length > 0 ? " OR JobOpDtl_OpDtlDesc LIKE '%Miyano%'" : "JobOpDtl_OpDtlDesc LIKE '%Miyano%'");
if (filterTornos) filters.Append(filters.Length > 0 ? " OR JobOpDtl_OpDtlDesc LIKE '%Tornos - Twiss%'" : "JobOpDtl_OpDtlDesc LIKE '%Tornos - Twiss%'");
if (filterTornos) filters.Append(filters.Length > 0 ? " OR JobOpDtl_OpDtlDesc LIKE '%Tornos Machine 2%'" : "JobOpDtl_OpDtlDesc LIKE '%Tornos Machine 2%'");
if (filterTornos) filters.Append(filters.Length > 0 ? " OR JobOpDtl_OpDtlDesc LIKE '%Tornos Machine 3%'" : "JobOpDtl_OpDtlDesc LIKE '%Tornos Machine 3%'");
if (filterTornos) filters.Append(filters.Length > 0 ? " OR JobOpDtl_OpDtlDesc LIKE '%Tornos Machine 4%'" : "JobOpDtl_OpDtlDesc LIKE '%Tornos Machine 4%'");
if (filterTornosMill) filters.Append(filters.Length > 0 ? " OR JobOpDtl_OpDtlDesc LIKE '%Tornos - Millgrove%'" : "JobOpDtl_OpDtlDesc LIKE '%Tornos - Millgrove%'");
if (filterTornosMill) filters.Append(filters.Length > 0 ? " OR JobOpDtl_OpDtlDesc LIKE '%Tornos Machine 1%'" : "JobOpDtl_OpDtlDesc LIKE '%Tornos Machine 1%'");
if (filterClean) filters.Append(filters.Length > 0 ? " OR JobOpDtl_OpDtlDesc LIKE '%Twiss Clean%'" : "JobOpDtl_OpDtlDesc LIKE '%Twiss Clean%'");

// If no filters were applied, set a default value (optional)
if (filters.Length == 0)
    filters.Append("JobOpDtl_OpDtlDesc = ''");

outputFilter = filters.ToString();

edit: just noticed the post is a year old :laughing:

1 Like

Very cool! How do you call the function to update the filter on the control?

I did try a where clause with two %'s and it worked like a contains.

eg.

image

‘%?{TransView.PONum}%’ for people wanting a cut and paste example

I’m not the original poster but I was playing with where clauses trying to figure out how to le them handle blank tracker fields.

It works if you generate the application from a classic dashboard but not if you create a new dashboard from scratch.

1 Like

Hi Tim

I used Epicor Functions Maintenance to define the function etc.
Then, in the event we can call the function directly before the BAQ even:
image

Pass all the parameters required that you defined in your function:
image

In the BAQ, use the table actionResult to get any return values / parameters from your function. This will always be ‘actionResult.yourParameterName’
image

Hope this helps!

Within actual Epicor Functions Maintenance:
Create your library and then under ‘Security’, ensure you auth your company
image

Give your library access to custom code and give DB access if required:
image

Then, we can select the new drop down and create a new custom code function:
image

Now that we have a function created, name this function and head to the ‘Signature’ tab - this is where we define our input and output parameters:
image

Finally, on Overview, click ‘edit’ and paste your code. You can also check syntax etc within the editor.

When this is finalized and ready for testing, use Actions → Promote Library to Production
image

Note, if any changes must be made to any functions in a library, you must demote the library from production in order to be able to make any changes. This will also break any applications you have made that call functions from this library or any scheduled functions etc while this is demoted.

1 Like