StateValidForZip()

<< Click to Display Table of Contents >>

Navigation:  Available Functions >

StateValidForZip()

Syntax

StateValidForZip( <cZip>, <cState> )

 

Purpose

Given a specific zip code and state abbreviation, this function will return true if the given zip and state are a valid combination to use in an address. When used in a custom selection, this function can identify the constituents in your database which have an invalid zip and state combination in their mailing address. Once in a selection result, these invalid addresses may then be viewed and corrected as a group. A typical custom selection expression using this function would be: StateValidForZip( .Zip., .State. )

 

Parameters

<cZip> Is the zip code to check. Must be a character (alpha-numeric) value since zip codes may contain a dash. In a custom selection, this is typically the .Zip. field, though it may be any field containing a zip code.

 

<cCounty> Is a character value giving the state abbreviation (in uppercase) to check. In a custom selection this is typically the .State. field, though it may be any field containing a state abbreviation.

 

Returns

A true/false value.

 

Usage

This function can be used with custom selections. For example, a custom selection could be written to find all the constituents which have an invalid zip and state combination in their main address.

 

Example

The following examples illustrate various results of StateValidForZip():

 

CALL

RESULT

StateValidForZip( "83864", "ID" )

True

StateValidForZip( "83864", "WA" )

False

StateValidForZip( "60657", "IL" )

True