I want to get all the contacts whose name contains this string ‘Jeff’, so I can get a result like this ‘Jeffer’, ‘Jefferson’, ‘Jeff’.
{% set events=crm_objects(“contact”, “firstname__in=Jeff’,”") %}
But it doesn’t work
I guess there is an operator I can use, like
{% set events=crm_objects(“contact”, “firstname__in=Jeff%',”") %}
Any ideas?
Hey, @ACarrillo7
My hunch is the __in won’t work the way you are expecting for partial string matching. In this case, the __in operator checks if the value is exactly in a list of specified values, not if it’s a part of any value. So, in this case, firstname__in=Jeff will only return contacts whose first name is exactly ‘Jeff’, not ‘Jefferson’, ‘Jeffer’, etc.
You’ll need to look at other approaches, such as creating a function to return all contacts and then filtering all the Jeff’s into an array. I understand this might not be efficient if you have numerous records to deal with.
Best,
Jaycee