0

So, I am able to use Lookup() to search for an exact term but how can I use lookup if i want search results that matches the search term.

If my data extension rows include values like "White Car", "Blue Car", "Black Car" etc.

I want to search for "Car" and lookup should display all values that are includes the search term "Car". Is it possible?

set @searchlookup = "car"
set @RowsReturn = 0
set @srows = LookupOrderedRows("Data_Extension","Column_Name", @searchlookup)

How can I search with some kind of wildcard in the search term?

1

Unfortunately, you can't offer anything other than an exact match using any of the Lookup() functions (though that'd be awesome). If there's not many rows, you loop through the return rowset and determine if the value of "car" exists in that field's value using IndexOf(). Something like:

set @searchlookup = "car"
set @RowsReturn = 0
set @srows = LookupOrderedRows("Data_Extension","Column_Name", @searchlookup)

for @i = 1 to RowCount(@srows) do
  set @row = Row(@srows,@i)
  if IndexOf(Field(@row,"FieldName"),"car") > 0 then
    /* Record has "car" in the field" */
  endif
next @i
1
  • This is the best way, unless you use a Query Activity to before the email send to do your wildcard search. – Adam Spriggs Feb 24 '17 at 21:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.