Hi all,
This seems like a very simple question, but searching for 'like' isn't very helpful and searching wildcards for csla isn't coming up with any usable results.
Basically, I would like to get business objects back that partially match a search term. For instance, if a user enters 'matt' I want results to include 'matt' and 'matthew'. Is there an easy way to do this via criteria or any other easy trick to denote a 'like' or 'wildcard' match on a string field that I am overlooking?
MyProperty.Contains("mysearchstring")
Hi Curelom - sorry, I should have been a bit more explicit. Here is my code:
PeopleCriteria fetchCriteria = new PeopleCriteria();
fetchCriteria.Name = nameToSearchFor;
DataPortal<People> dp = new DataPortal<People>();
dp.FetchCompleted += UpdateSearchResults_FetchCompleted;
dp.BeginFetch(fetchCriteria);
You will notice the second line I am setting the name to whatever I want to search for. But using the criteria like that translates into equality. Is there any way in the criteria to specify that, instead of doing an equals, I want to do a like for that particular field? We need the ability to do either/or, so it's not like I can just switch to always doing a .Contains in the fetch method.
Could you show your DataPortal Fetch method?
Hi,
Add more properties to your criteria object to instruct which type of search to perform i DataPortal_Fetch
Hi Jonny,
Thanks again for the answer - very simple and straightforward. I just added the property and the following line, and now in my fetch I can differentiate between equals and like.
fetchCriteria.MatchPartialName = true;
Copyright (c) Marimer LLC