I want to search for companies between a range of zip codes.
Example:
zip code < 50000
and
zip code > 40000
But it seems, that I can't do that with the advanced find, correct ? Is it possible to do this with fetchxml ?
BTW, the zip code can also be something like: AV300
In this case it should also do the same string comparison.
*This post is locked for comments
Divyang,
Through Fetch XML you can use gt and lt operators on string fields but they do sting comparisons, not numeric. Suppose you had a string field with values:
100
100000
20000
5000
9
If you queried for value gt 40000, you would get back 5000 and 9.
No it is not possible, As zip code is String we cannot filter using gt or lt. But we can use below listed operators to filter.
Hi Aiden,
thats exactly what I need. Thanks a lot !
I dont have my laptop with me so I couldnt test it right a way.
Hi Donny,
Yes, you can do that through fetch xml, I just ran this test looking for an account with postal code 12345.
<fetch count="25"> <entity name="account"> <attribute name="address2_postalcode" /> <filter type="and"> <condition attribute="address2_postalcode" value="12344" operator="gt"/> </filter> </entity> </fetch>
Changing the value in the condition changes the results as you'd expect.
A word of warning though - the condition here is doing a string compare and not a numeric compare. You could do the same comparison with Name:
<condition attribute="name" value="B" operator="gt"/>
would bring back accounts whose name is "B ", "B1", anything that doesn't start with A.
Hope this helps! I'd appreciate if you'd mark this as Answering your question.
Thanks,
Aiden
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,134 Super User 2024 Season 2
Martin Dráb 229,928 Most Valuable Professional
nmaenpaa 101,156