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

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?

1 Like

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.

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.

No! How do you do that?!?

2 Likes

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.

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?

“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.

Searching for CK, and it limits it to

Here’s the Criteria panel from the Quick Search entry

image

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

Base Search

Settings
image

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

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

1 Like

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.

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
  5. Experimented with changing ttQuickSearchCriteria.CriteriaValue
1 Like

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

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?

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

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?

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

(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

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.

1 Like

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:

  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);
  }

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

row["Seq"] = Seq + i;
1 Like