CityValidForZip()

<< Click to Display Table of Contents >>

Navigation:  Available Functions >

CityValidForZip()

Syntax

CityValidFor( <cZip>, <cCity>, <IgnoreCase> )

 

Purpose

Given a specific zip code and city name, this function will return true if the given zip and city 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 city 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: CityForZip( .Zip., .City. )

 

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.

 

<cCity> Is a character value giving the city to check. In a custom selection this is typically the .City. field, though it may be any field containing a city name.

 

<IgnoreCase> Pass as True if you wish case to be ignored when checking whether or not a given zip and city combination are valid. Defaults to True.

 

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 city combination in their main address.

 

Example

The following examples illustrate various results of CityValidForZip():

 

CALL

RESULT

CityForZip( "83864", "Sandpoint" )

True

CityForZip( "83864", "Seattle" )

False

CityForZip( "83864", "SandPoint" )

True

CityForZip( "83864", "SandPoint", .F. )

False

CityForZip( "60657", "Chicago" )

True