# Zip Code Distance Calculation

## Domino Resources - Part 4

### Looking for something else?

I've developed a Formula language and LotusScript version of the formula to
calulate the distance between two zip codes in the US. The Formula language
version is included below.

There are several subscription zip code services available that will make
available a list of all valid zip codes in the country. You can arrange to
have the location of the zip code included in the file. The zip code itself is
great for validating data entry, but there are other ways to use the
information once it is 'in house'. To use this example:

1. Add the code below to a view action button in a database of zip codes.
2. Select one zip code in a view.
3. Click on the button and select a second zip code from the list.
4. See the distance between zip codes.

The script version has been great for calculating the closest vendor for a
company to work with and many similar applications.

Note: I have a small freely distributable DB of zip codes that I could include
with this example code to make it work out of the box.

Take a look and let me know what you think.
Andy
ziplist := @DbColumn("";"":"";"ZipCode";1);
zipToUse := @Prompt([OKCANCELLIST]; "Select a Zip Code"; "Select a zip code to
calculate distance from the selected zip."; "";ziplist);
zipRLat := @DbLookup("":"Cache" ; ""; "ZipCode"; zipToUse; "RadLatitude");
zipRLong := @DbLookup("":"Cache" ; ""; "ZipCode"; zipToUse; "RadLongitude");
zipCity := @DbLookup("":"Cache" ; ""; "ZipCode"; zipToUse; "City");
zipState := @DbLookup("":"Cache" ; ""; "ZipCode"; zipToUse; "State");

CalcX :=

RadDist := @ATan(-CalcX / @Sqrt(-CalcX * CalcX + 1)) + 2 * @ATan(1);
RndDistMI := @If(DistMi = 0;0;@Integer(DistMI * 10)/10);
@Prompt([OK];"Miles"; "Distance: " + @Text( RndDistMI) + " miles. From " +
City + ", " + State + " to " + zipCity + ", " + zipState + ".")
This was last published in November 2000

#### Start the conversation

Send me notifications when other members comment.

## SearchWindowsServer

• ### Windows Management Framework 5 update gives PowerShell users a fix

Microsoft answered admin requests for new features and fixed several bugs with its WMF 5.1 release, giving users a slew of ...

• ### Pester PowerShell unit testing ensures quality code

PowerShell jockeys can turn to the Pester unit testing framework to ensure the code they write is up to snuff.

• ### Microsoft software-defined networking gets baked into Windows Server

The Microsoft SDN technology that comes in the Windows Server 2016's Datacenter edition features a range of basic to nuanced ...

## Search400

• ### iSeries tutorials

Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

• ### V6R1 upgrade planning checklist

When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

• ### Connecting multiple iSeries systems through DDM

Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

## SearchEnterpriseLinux

• ### SUSE Linux jumps on the open private cloud deployment train

SUSE Linux Enterprise planning private cloud deployment with OpenStack weight behind it. NVIDIA works on Linux drivers for ...

• ### Want one of the many Linux jobs out there? Time to go back to class

Does extended education from the Linux Foundation and others help graduates meet the demands of today’s Linux jobs? Some say yes.

• ### Ubuntu ARM server AMI for Amazon EC2 offers fast access in the cloud

Canonical’s Ubuntu ARM server AMI for Amazon EC2 provide open source shops with a fast ARM server for the cloud.

## SearchDataCenter

• ### HPE-SimpliVity deal raises support, price and development questions

With HPE's buy of No. 2 SimpliVity -- the first big deal in the HCI space -- IT pros see a more robust offering, but also higher ...

• ### Converged infrastructure drop-off doesn't mean data center death

Traditional converged infrastructure has been supplanted by hyper-converged infrastructure and cloud computing, but it remains a ...

• ### New options to evolve your data backup and recovery plan

The server backup market first evolved to protect VMs, but now it's undergoing another transformation. Find out how it's evolved ...

## SearchExchange

• ### Beware of these six Office 365 cons for IT shops accustomed to on premises

Office 365 offers many benefits, but there are plenty of cons to consider before leaping to this cloud-based productivity suite ...

• ### Five reasons for an Office 365 hybrid deployment

Not all organizations can go all-in on cloud. There are five reasons why a hybrid Office 365 arrangement makes sense for those ...

Admins must keep a close eye on Exchange Server to ensure it runs at peak performance. If cost is an issue, there are a number of...

## SearchContentManagement

• ### Why SharePoint Framework could benefit business, not just developers

SharePoint Framework heralds a new, mobile-friendly, low-code era for Microsoft, which may give some organizations without .NET ...

• ### Using Microsoft MyAnalytics to improve workers' time management

Microsoft MyAnalytics has been hailed as the next great thing for analyzing worker productivity. But how can employees be assured...

• ### Is the Drupal content management system right for your business?

The open source Drupal content management system offers users responsive design and WYSIWYG content and web development tools, as...

Close