Skip to Content
0
Jul 06, 2011 at 02:36 AM

List of items form - how to do substring search ?

21 Views

Let's say I have one item in the OITM with the ItemName field equal to

"The quick brown fox jumped over the lazy dog".

and the ItemCode equal to "ABC"

The default behavior is that if I search for "AB" in the ItemCode, the "List of Items" form will show that item.

If I search for "BC" in the ItemCode, the "List of Items" form will be empty.

Furthermore, if I search for "The quick" in the ItemName, the item shows up in the "List of Items" form.

However, if I search for "brown fox", nothing shows up.

I know this sounds trivial, but how do I override search parameters that get passed onto the "List of Items" form?

What I'd like to do is to be able to enter a value of "brown fox lazy dog" in the ItemName in the Item Master form, hit tab, and have the "List of Items" form pull up the item by doing a substring search on ItemName, such as this:

WHERE ItemName LIKE '%brown%' AND ItemName LIKE '%fox%' AND ItemName LIKE '%lazy%' AND ItemName LIKE '%dog%'.

I have tried to do trigger an ItemEvent via a FORM_LOAD with just the word "brown":

            If pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD AND pVal.FormType = 10003 Then
                ds = f.DataSources.DBDataSources.Item("OITM")
                conditions = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_Conditions)
                cond = conditions.Add()
                cond.Alias = "ItemName"
                cond.Operation = SAPbouiCOM.BoConditionOperation.co_CONTAIN
                cond.CondVal = "brown"
                ds.Query(conditions)
            End If

That however, returns an error.