Customization InvokeSeach SearchOptions whereClause to search for a string in UD14 Key1 that begins with a string value

I am trying to search for any Key1 in UD14 that begins or contains or is like a string value ponum which currently contains ‘80057’.
I display a message before the search of the whereClause which shows:


My search code is below, then my data in UD14, then an error when I use CONTAINS.
If I use LIKE it returns no rows.
If I use BEGINS it errors with invalid sytax.
If I use CONTAINS it give the error below.

Does anyone know how to do this?
Please help!
Thank you,
Richard

SearchOptions searchOption = new SearchOptions(SearchMode.AutoSearch) { DataSetMode = DataSetMode.RowsDataSet };
string whereClause = “Key1 CONTAINS '” + ponum + “'”;
searchOption.NamedSearch.WhereClauses.Add(“UD14”,whereClause);
this.oTrans.InvokeSearch(searchOption);

UD14 Key1
80057 2025-10-07 17:29:19
80057 2025-10-09 15:35:13
80057 2025-10-09 15:35:43
80057 2025-10-09 15:59:00

Inner Exception Message: Cannot use a CONTAINS or FREETEXT predicate on table or indexed view ‘Ice.UD14’ because it is not full-text indexed.

Try LIKE ‘%’ + ‘80057’ + ‘%’ expression

The ‘%’ are wildcards so this says LIKE 80057 with anything before and anything after

1 Like

string whereClause = “Key1 LIKE '%” + ponum + “%'”;

This worked!!!

Thank you 1 million times Todd. You are a life saver.

I need to just remember that the whereClause is identical to a SQL query line.

2 Likes