# Why does my "matches" wildcard criteria work on a BAQ, but not in a quick search?

**URL:** <https://www.epiusers.help/t/why-does-my-matches-wildcard-criteria-work-on-a-baq-but-not-in-a-quick-search/50164>\
**Category:** Epicor ERP 10\
**Tags:** quick-search\
**Created:** [November 29, 2018, 5:17pm UTC](https://www.epiusers.help/t/why-does-my-matches-wildcard-criteria-work-on-a-baq-but-not-in-a-quick-search/50164 "2018-11-29T17:17:12Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adam](https://www.epiusers.help/letter_avatar_proxy/v4/letter/a/4af34b/32.png) [@Adam](https://www.epiusers.help/u/Adam)\
**Post date:** [November 29, 2018, 5:17pm UTC](https://www.epiusers.help/t/why-does-my-matches-wildcard-criteria-work-on-a-baq-but-not-in-a-quick-search/50164/1 "2018-11-29T17:17:12Z")

</div>

I have a basic BAQ called “CustomerCommentSearch” and it displays Customer.CustID and Customer.Comment.

In the BAQ, if I add a matches type criteria and set the specified constant to _refused_, I get all of the customers with “refused” somewhere in their comments… good.

HOWEVER, if I remove the BAQ matches criteria and add a matches condition / prompt criteria to the QuickSearch, I get get zero results… bad.

I’m typing in _refused_ on the prompt window. Shouldn’t a QuickSearch wildcard work the same as a BAQ?

---

<div class="post-metadata">

**Author:** ![Adam](https://www.epiusers.help/letter_avatar_proxy/v4/letter/a/4af34b/32.png) [@Adam](https://www.epiusers.help/u/Adam)\
**Post date:** [November 29, 2018, 5:26pm UTC](https://www.epiusers.help/t/why-does-my-matches-wildcard-criteria-work-on-a-baq-but-not-in-a-quick-search/50164/2 "2018-11-29T17:26:32Z")

</div>

Got it.

`It appears that in a BAQ either *text* OR %text% works as wildcard characters, BUT on the QuickSearch, only % works as a wildcard character.`

---

<div class="post-metadata">

**Author:** ![bmgarver](https://www.epiusers.help/user_avatar/www.epiusers.help/bmgarver/32/2867_2.png) [@bmgarver](https://www.epiusers.help/u/bmgarver)\
**Post date:** [November 29, 2018, 5:35pm UTC](https://www.epiusers.help/t/why-does-my-matches-wildcard-criteria-work-on-a-baq-but-not-in-a-quick-search/50164/3 "2018-11-29T17:35:36Z")

</div>

Have you tried the Matches criteria in Quick Search without adding wildcards to the search word? Ones that I have created do not require wildcards to be included with the search words.

 ![image](https://epiusers.help/uploads/default/original/2X/1/1e826c50c8d68712ead0301337e6501a22a5fe11.png)

---

<div class="post-metadata">

**Author:** ![Adam](https://www.epiusers.help/letter_avatar_proxy/v4/letter/a/4af34b/32.png) [@Adam](https://www.epiusers.help/u/Adam)\
**Post date:** [November 29, 2018, 6:10pm UTC](https://www.epiusers.help/t/why-does-my-matches-wildcard-criteria-work-on-a-baq-but-not-in-a-quick-search/50164/4 "2018-11-29T18:10:17Z")

</div>

No! How do you do that?!?

---

<div class="post-metadata">

**Author:** ![bmgarver](https://www.epiusers.help/user_avatar/www.epiusers.help/bmgarver/32/2867_2.png) [@bmgarver](https://www.epiusers.help/u/bmgarver)\
**Post date:** [November 29, 2018, 7:44pm UTC](https://www.epiusers.help/t/why-does-my-matches-wildcard-criteria-work-on-a-baq-but-not-in-a-quick-search/50164/5 "2018-11-29T19:44:32Z")

</div>

![image](https://epiusers.help/uploads/default/original/2X/f/f61c6890c1cc7aa7b0c01f82f3dbe7e945513bf1.png)

---

<div class="post-metadata">

**Author:** ![Adam](https://www.epiusers.help/letter_avatar_proxy/v4/letter/a/4af34b/32.png) [@Adam](https://www.epiusers.help/u/Adam)\
**Post date:** [November 29, 2018, 7:49pm UTC](https://www.epiusers.help/t/why-does-my-matches-wildcard-criteria-work-on-a-baq-but-not-in-a-quick-search/50164/6 "2018-11-29T19:49:19Z")

</div>

Odd. That’s what I was doing, but I thought it would require wildcard characters. Apparently it doesn’t need them on QuickEntries, only on BAQs.

Thank you.

---

<div class="post-metadata">

**Author:** ![dr\_dan](https://www.epiusers.help/user_avatar/www.epiusers.help/dr_dan/32/48005_2.png) [@dr\_dan](https://www.epiusers.help/u/dr_dan)\
**Post date:** [December 8, 2020, 5:21pm UTC](https://www.epiusers.help/t/why-does-my-matches-wildcard-criteria-work-on-a-baq-but-not-in-a-quick-search/50164/7 "2020-12-08T17:21:33Z")

</div>

In your experience, is there a way to replicate the default “description” search in a quick search? For example, the default search seems to work more like a Google search - return instances where all combinations of the search terms exist. However, in a quick search, matches or starts with doesn’t seem to work as well. Any suggestions?

---

<div class="post-metadata">

**Author:** ![ckrusen](https://www.epiusers.help/user_avatar/www.epiusers.help/ckrusen/32/50584_2.png) [@ckrusen](https://www.epiusers.help/u/ckrusen)\
**Post date:** [December 8, 2020, 5:37pm UTC](https://www.epiusers.help/t/why-does-my-matches-wildcard-criteria-work-on-a-baq-but-not-in-a-quick-search/50164/8 "2020-12-08T17:37:12Z")

</div>

“Matches” Will find the value anywhere in the field.

The following screen shot has a criteria of MATCHES. So just entering `C` finds all of the following.

 ![image](https://www.epiusers.help/uploads/default/original/3X/2/f/2fadd0673fbbe83db7ca4d5d80f2fb80469cfe4a.png)

Searching for `CK`, and it limits it to

 ![image](https://www.epiusers.help/uploads/default/original/3X/e/0/e0084dc6ca9ea6b4f1fcbafb8adc05fff5f72196.png)

Here’s the Criteria panel from the Quick Search entry

![image](https://www.epiusers.help/uploads/default/original/3X/0/4/04ccb5c6929056c1e611129f58c9a3eff447056c.png)

---

<div class="post-metadata">

**Author:** ![dr\_dan](https://www.epiusers.help/user_avatar/www.epiusers.help/dr_dan/32/48005_2.png) [@dr\_dan](https://www.epiusers.help/u/dr_dan)\
**Post date:** [December 8, 2020, 7:15pm UTC](https://www.epiusers.help/t/why-does-my-matches-wildcard-criteria-work-on-a-baq-but-not-in-a-quick-search/50164/9 "2020-12-08T19:15:53Z")

</div>

Calvin,  
Below is what I am referring to. A search with multiple words doesn’t work well with the matches condition. I’m hoping to replicate the functionality of the base search when entering multiple words.

Quick Search

 ![image](https://www.epiusers.help/uploads/default/original/3X/f/8/f8d2d6d7546a117d5c692e1123783fbd6e96479b.png)

Base Search

 ![image](https://www.epiusers.help/uploads/default/original/3X/3/f/3f09363994349fe45c15d4977060b0bdc856a4a0.png)

Settings  
 ![image](https://www.epiusers.help/uploads/default/original/3X/4/2/42df6fe8f4bdb1976194979f65ea9a32b0970360.png)

---

<div class="post-metadata">

**Author:** ![ckrusen](https://www.epiusers.help/user_avatar/www.epiusers.help/ckrusen/32/50584_2.png) [@ckrusen](https://www.epiusers.help/u/ckrusen)\
**Post date:** [December 8, 2020, 7:51pm UTC](https://www.epiusers.help/t/why-does-my-matches-wildcard-criteria-work-on-a-baq-but-not-in-a-quick-search/50164/10 "2020-12-08T19:51:41Z")

</div>

Found a solution…

Make a Pre-Proc BPM on Ice.QuickSearch.RunQuickSearchPaged. Use a Set Field widget to update the value of `ttQuickSearchCriteria.CriteriaValue`, replacing the spaces with percent signs.

like: ` BpmFunc.Replace(ttQuickSearchCriteriaRow.CriteriaValue," ","%")`

It’ll take a little more logic to make sure you’re only tweaking the CriteriaValue on rows where `CriteriaType == "Prompt"`

With the BPM enabled, a search for `#12 white` yields:

![image](https://www.epiusers.help/uploads/default/original/3X/2/0/208a88e7a9d8ac75b8a350f2aafa052faeb470ca.png)

if the BPM is disabled, that search return nothing.

# edit

A Set By Query widget would be better as the query can limit the records to change

---

<div class="post-metadata">

**Author:** ![dr\_dan](https://www.epiusers.help/user_avatar/www.epiusers.help/dr_dan/32/48005_2.png) [@dr\_dan](https://www.epiusers.help/u/dr_dan)\
**Post date:** [December 8, 2020, 7:56pm UTC](https://www.epiusers.help/t/why-does-my-matches-wildcard-criteria-work-on-a-baq-but-not-in-a-quick-search/50164/11 "2020-12-08T19:56:32Z")

</div>

Very cool. I’ll give that a shot. What did you search to come up with that? I did Google this topic and that’s how I ended up in this thread.

---

<div class="post-metadata">

**Author:** ![ckrusen](https://www.epiusers.help/user_avatar/www.epiusers.help/ckrusen/32/50584_2.png) [@ckrusen](https://www.epiusers.help/u/ckrusen)\
**Post date:** [December 8, 2020, 8:02pm UTC](https://www.epiusers.help/t/why-does-my-matches-wildcard-criteria-work-on-a-baq-but-not-in-a-quick-search/50164/12 "2020-12-08T20:02:44Z")

</div>

I …

1. Enabled tracing
2. Ran a quick search
3. Looked at the trace log for my QS’s criteria
4. Found the BO, method, and dataset that holds it  
 ![image](https://www.epiusers.help/uploads/default/original/3X/5/1/51d3aff1331f3f70d2a2c1fd9613da348934342d.png)
5. Experimented with changing `ttQuickSearchCriteria.CriteriaValue`

---

<div class="post-metadata">

**Author:** ![dr\_dan](https://www.epiusers.help/user_avatar/www.epiusers.help/dr_dan/32/48005_2.png) [@dr\_dan](https://www.epiusers.help/u/dr_dan)\
**Post date:** [December 8, 2020, 8:09pm UTC](https://www.epiusers.help/t/why-does-my-matches-wildcard-criteria-work-on-a-baq-but-not-in-a-quick-search/50164/13 "2020-12-08T20:09:40Z")

</div>

Interesting. Google wouldn’t have helped with that! Makes total sense, though. Thanks, again.

---

<div class="post-metadata">

**Author:** ![dr\_dan](https://www.epiusers.help/user_avatar/www.epiusers.help/dr_dan/32/48005_2.png) [@dr\_dan](https://www.epiusers.help/u/dr_dan)\
**Post date:** [March 1, 2021, 9:56pm UTC](https://www.epiusers.help/t/why-does-my-matches-wildcard-criteria-work-on-a-baq-but-not-in-a-quick-search/50164/14 "2021-03-01T21:56:37Z")

</div>

I am trying to apply this same concept to tweaking my Task List so that it doesn’t always filter by the sales rep that is entered. We want to display all tasks in that view. Would you still replace the text with % signs? Or would I just wipe the salesrepcode out altogether so that it’s not being filtered at all?

---

<div class="post-metadata">

**Author:** ![ckrusen](https://www.epiusers.help/user_avatar/www.epiusers.help/ckrusen/32/50584_2.png) [@ckrusen](https://www.epiusers.help/u/ckrusen)\
**Post date:** [March 2, 2021, 12:11am UTC](https://www.epiusers.help/t/why-does-my-matches-wildcard-criteria-work-on-a-baq-but-not-in-a-quick-search/50164/15 "2021-03-02T00:11:59Z")

</div>

If the ttQuickSearchCriteriaRow.CriteriaValue is being set with the SalesRepCode, by the form, try setting it to `""` or `"%"`

---

<div class="post-metadata">

**Author:** ![dr\_dan](https://www.epiusers.help/user_avatar/www.epiusers.help/dr_dan/32/48005_2.png) [@dr\_dan](https://www.epiusers.help/u/dr_dan)\
**Post date:** [March 30, 2021, 12:36pm UTC](https://www.epiusers.help/t/why-does-my-matches-wildcard-criteria-work-on-a-baq-but-not-in-a-quick-search/50164/16 "2021-03-30T12:36:13Z")

</div>

This is a great start. It does exactly what we thought it would do with a **#12 white** search…

I am hoping to go a step further, now. I believe this forces us to enter the search terms in the order that they appear in the description. Essentially, our search criteria ends up looking like:

```
WHERE Part.PartDescription LIKE '%#12%WHITE%'

```

so it’s looking for #12 to appear in any position with white in any position after it.

Any thoughts on how we might trick it to search for either in any position?

---

<div class="post-metadata">

**Author:** ![ckrusen](https://www.epiusers.help/user_avatar/www.epiusers.help/ckrusen/32/50584_2.png) [@ckrusen](https://www.epiusers.help/u/ckrusen)\
**Post date:** [March 30, 2021, 1:05pm UTC](https://www.epiusers.help/t/why-does-my-matches-wildcard-criteria-work-on-a-baq-but-not-in-a-quick-search/50164/17 "2021-03-30T13:05:07Z")

</div>

It would be more complicated than just taking the users search string and replacing spaces with percent signs. And might not be possible, since it is search criteria, and not a true WHERE clause.

If you have access to the where clause, you could convert the search phrase into several parts, and build a complex where clause. For example, searching for

` Hello there world`

would need a where clause like

```nohighlight
(Desc = '%Hello%there%world%') OR (Desc = '%Hello%world%there%') 
 OR (Desc = '%world%Hello%there%') OR (Desc = '%world%there%Hello%') 
 OR (Desc = '%there%world%%Hello%') OR (Desc = '%there%Hello%world%')

```

You’d need to split it into the number of words, then iteratively build the phrase of every possible combo. The number of combos’ is the factorial of the number of 3 words. For 3 words, it would be 3! = 6. The combos are:  
1-2-3  
1-3-2  
2-1-3  
2-3-1  
3-1-2  
3-2-1

---

<div class="post-metadata">

**Author:** ![dr\_dan](https://www.epiusers.help/user_avatar/www.epiusers.help/dr_dan/32/48005_2.png) [@dr\_dan](https://www.epiusers.help/u/dr_dan)\
**Post date:** [March 30, 2021, 1:11pm UTC](https://www.epiusers.help/t/why-does-my-matches-wildcard-criteria-work-on-a-baq-but-not-in-a-quick-search/50164/18 "2021-03-30T13:11:21Z")

</div>

I am experimenting with iterative searches as we speak. I have learned that I can programmatically set the existing criteria value to whatever I want (custom code). No surprise there…

My plan is to split the description on the spaces and the loop through each term and dynamically create a new criteria for each separate term. It should treat them like an “AND” in the WHERE so it should end up something like having 2 or 3 or 4 separate part description boxes with one word in each. Fingers crossed.

---

<div class="post-metadata">

**Author:** ![dr\_dan](https://www.epiusers.help/user_avatar/www.epiusers.help/dr_dan/32/48005_2.png) [@dr\_dan](https://www.epiusers.help/u/dr_dan)\
**Post date:** [March 30, 2021, 2:55pm UTC](https://www.epiusers.help/t/why-does-my-matches-wildcard-criteria-work-on-a-baq-but-not-in-a-quick-search/50164/20 "2021-03-30T14:55:36Z")

</div>

I’ve been able to use the .Add(row) method to the ttQuickSearchCriteria table but it only seems to accept the final row I add. In other words, if I create a search for “rubber elbow”, I get all results as though I only typed “elbow”. If I reverse those, I get results as though I only typed “rubber”. Is there a trick to get it to accept multiple rows? Should I be including something after the Add method (like an Update or something)? See below snippet from my method directive on Ice.QuickSearch.RunQuickSearchPaged:

```auto
  for (int i = 0; i < searchTerms.Length; i++)
  {
    CriteriaValue = searchTerms[i];
    
    var row = ttQuickSearchCriteria.NewRow();
    row["Company"] = Company;
    row["QuickSearchID"] = QuickSearchID;
    row["GlbCompany"] = GlbCompany;
    row["Seq"] = Seq;
    row["DataTableID"] = DataTableID;
    row["FieldName"] = FieldName;
    row["DataType"] = DataType;
    row["FieldLabel"] = FieldLabel;
    row["CompOp"] = CompOp;
    row["CriteriaType"] = CriteriaType;
    row["IsReturnCol"] = IsReturnCol;
    row["CriteriaValue"] = CriteriaValue;
    row["FilterOnNull"] = FilterOnNull;
    row["SystemFlag"] = SystemFlag;
    row["CriteriaField"] = CriteriaField;
    row["CriteriaLikeFieldName"] = CriteriaLikeFieldName;
    row["CriteriaLikeTableID"] = CriteriaLikeTableID;
    row["FieldFormat"] = FieldFormat;
    row["LikeField"] = LikeField;
    row["BitFlag"] = BitFlag;
    row["RowMod"] = "A";
    
    ttQuickSearchCriteria.Add(row);
  }

```

---

<div class="post-metadata">

**Author:** ![ckrusen](https://www.epiusers.help/user_avatar/www.epiusers.help/ckrusen/32/50584_2.png) [@ckrusen](https://www.epiusers.help/u/ckrusen)\
**Post date:** [March 30, 2021, 3:47pm UTC](https://www.epiusers.help/t/why-does-my-matches-wildcard-criteria-work-on-a-baq-but-not-in-a-quick-search/50164/21 "2021-03-30T15:47:47Z")

</div>

I think the `row["Seq"] ` value needs to be differnt for each row. try something like

```cs
row["Seq"] = Seq + i;

```

[Next page](https://www.epiusers.help/t/why-does-my-matches-wildcard-criteria-work-on-a-baq-but-not-in-a-quick-search/50164.md?page=2)
