Best Practice for Zip Code Criteria

I'm trying to set up a few lists for my team to be able to pull donors in a certain zip code and am struggling with the appropriate way to truly include everyone in those zip codes. We store both the standard five and five plus four zips in our instance of Tessitura and when I choose the criteria of Like with the 5 digit zip code it seems to skip anyone with the plus four. When I add the wild card indicator to the end of the 5 digits I'm looking for it includes anyone with those five digits in a row. Any advice?
Parents
  • Here is some code I use for zip codes within a radius, which includes code for getting the first five of plus-fours.  Just skip going on the internet to get your zips and insert instead the ones you picked by some other method.  The <hyphen hyphen> comments out in Tessitura;  I usually leave my comments for whomever comes across my query later.  

     

     

    Before you go to Tessitura, get the zips in the selected radius. Just leaving this in for anyone trying to do something with constituents in a geographic area.

    --http://www.freemaptools.com/find-zip-codes-inside-radius.htm 

     

    --save as csv, so (depending on what you open the file with--use simplest possible text viewer) you have comma separated text just as it appears below.  If you open in Excel, the commas convert to fields, and if you open in notepad, they convert to one zip per line, and for this you need the commas.   

     

     

    In Tessitura,  the zips go between the parentheses near the end of this query:

     

    Select Distinct a.customer_no
    From V_CUSTOMER_WITH_PRIMARY_GROUP a  WITH (NOLOCK)
    JOIN (Select a1.customer_no From vs_address a1 WITH (NOLOCK) Where

    a1.inactive in ('n')
    --only active addresses for this list  substitute a1.primary_ind in ('Y') for primary addresses only      remove the line altogether to include inactive addresses

    and a1.postal_code LIKE '[0-9][0-9][0-9][0-9][0-9]'
    --only numeric codes because it throws errors if you have text in the postal code. You can change 0-9 to A-Z as needed for foreign codes. 

    and  left (a1.postal_code,5)
    --no accidental offsets into the plus 4 digits a la 77075-0015 = 75001
    in (75001,75023,75025,75026,75040,75042,75044,75045,75046,75047,75048,75049,75074,75075,75080,75081,75082,75083,75085,75086,75093,75094,75230,75231,75238,75240,75243,75248,75251,75252,75254,75287,75023,75024,75025,7502675074,75075,75086,75093,75094,75082,75044,75040,75048,75056,75034,75035,75006,75234,75229,75244,75254,75240,75225,75205,75204,75220, 75225, 75229, 75230, 75244))
    as e ON e.customer_no = a.customer_no

     

    From: Tessitura Technical Forum [mailto:forums-technical@tessituranetwork.com] On Behalf Of Gawain Lavers
    Sent: Thursday, January 19, 2017 2:43 PM
    To: John Trimble <J.Trimble@dbdt.com>
    Subject: Re: [Tessitura Technical Forum] Best Practice for Zip Code Criteria

     

    Hi Brandi, Can you post the query your list is creating? I.e. click on "manual query" and copy and paste the code? Thanks, Gawain

    From: Brandi Sellers <bounce-brandisellers7592@tessituranetwork.com>
    Sent: 1/19/2017 3:01:02 PM

    Thanks for your response! I think the challenge with that as a value is that if the last four digits combined with the end of the zip result in the same value, it's pulling them as well. I basically am looking for people that have the exact same first five digits and I don't care what the last four are. I'm guessing I'll be going to SQL for this one.




    This message was sent automatically to you by www.tessituranetwork.com because you subscribed to the Tessitura Technical Forum. You may reply to this message to post to the Technical forum or visit the site to search, read and post to the forums. In the interest of keeping the forum posts from becoming cluttered, we encourage you to delete previous message text from your reply before sending. Thank you!

  • Former Member
    Former Member $organization in reply to John Trimble
    John, the online map tool is very handy. Your code, too. Thanks for sharing!
Reply Children
No Data