Best way to apply filtering on a grid based on a couple of text and checkbox controls?

lets say I have a grid that shows me part numbers and part descriptions.

I have two text boxes for search, one is for part number and the other is for description. I also have two checkboxes to allow user select “Match Case” for either of the text search controls.

As you can see we already have so many combinations if I were to create a series of row-Update, Condition and so on to create my where clause and then apply it on my dataview.

Is there a better/faster approach to this?

What if I have a few more filter items that Ill need to add later on, making the combinations astronomically higher.

Is this a BAQ grid? or is this based on a PartSvc method like “GetList”, etc.?

I don’t know if rest call JS expressions would accept COLLATE or not (Epicor has a tendency to pre-parse stuff before sending it to the SQL server)… but something like the below JS expression would be worth trying as your Where clause expression:

… adjust to your bindings…

[
  ({TransView.PartNum} ?? "") !== ""
    ? (
        {TransView.PartNumMatchCase}
          ? "PartNum COLLATE Latin1_General_CS_AS LIKE '%" +
            ({TransView.PartNum} ?? "").replaceAll("'", "''") +
            "%'"
          : "PartNum LIKE '%" +
            ({TransView.PartNum} ?? "").replaceAll("'", "''") +
            "%'"
      )
    : "",

  ({TransView.Description} ?? "") !== ""
    ? (
        {TransView.DescriptionMatchCase}
          ? "PartDescription COLLATE Latin1_General_CS_AS LIKE '%" +
            ({TransView.Description} ?? "").replaceAll("'", "''") +
            "%'"
          : "PartDescription LIKE '%" +
            ({TransView.Description} ?? "").replaceAll("'", "''") +
            "%'"
      )
    : ""
]
.filter(x => x !== "")
.join(" AND ")

Yes it is a BAQ based grid. I have tried similar JS but it throws exceptions like invalid function for .REPLACE or other keywords.