ColdFusion8-Demographics

From CDYNE Wiki
Jump to: navigation, search

Tested with ColdFusion8 and Dreamweaver CS4

CFM1-Demographics.gif


Make sure you add the Web Services WSDL in the Dreamweaver 'Components' toolbar.

http://ws.cdyne.com/psaddress/addresslookup.asmx?wsdl

Dreamweaver-components.gif


demographics.cfm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Form Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<!--- If the form is submitted, call demographics web service --->
<cfif isDefined("FORM.Submit")>
<cfinvoke
webservice="http://ws.cdyne.com/DemographixWS/DemographixQuery.asmx?wsdl"
method="getLocationInformationByAddress"
returnvariable="aSummaryInformation">
<cfinvokeargument name="addressLine1" value=#FORM.Address#/>
<cfinvokeargument name="city" value=#FORM.City#/>
<cfinvokeargument name="stateAbbrev" value=#FORM.State#/>
<cfinvokeargument name="zipCode" value=#FORM.Zip#/>
<cfinvokeargument name="licenseKey" value="0ce54535-e73d-4346-9e22-31435b0d7d66"/>
</cfinvoke>
<table width="660" border="0" cellspacing="0" cellpadding="0">
<tr>
ZIP + 4 Demographic Information<br /><br />
<td>
Average Age : <cfoutput>#aSummaryInformation.MedianAge#</cfoutput> Years<br />
Average Income : $<cfoutput>#aSummaryInformation.MedianIncome#</cfoutput><br />
Rooms in Home : <cfoutput>#aSummaryInformation.MedianRoomsInHouse#</cfoutput><br />
Home Value : $<cfoutput>#aSummaryInformation.MedianHouseValue#</cfoutput><br />
Automobiles Per Home : <cfoutput>#aSummaryInformation.MedianVehicles#</cfoutput><br />
</td>
<td>
Married : <cfoutput>#aSummaryInformation.MaritalStatusPercentages.Married#</cfoutput>%<br />
Separated : <cfoutput>#aSummaryInformation.MaritalStatusPercentages.Separated#</cfoutput>%<br />
Divorced : <cfoutput>#aSummaryInformation.MaritalStatusPercentages.Divorced#</cfoutput>%<br />
Widowed : <cfoutput>#aSummaryInformation.MaritalStatusPercentages.Widowed#</cfoutput>%<br />
Never Married : <cfoutput>#aSummaryInformation.MaritalStatusPercentages.NeverMarried#</cfoutput>%<br />
</td>
<td>
African American: <cfoutput>#aSummaryInformation.RacePercentages.Black#</cfoutput>%<br />
Asian Percentage : <cfoutput>#aSummaryInformation.RacePercentages.Asian#</cfoutput>%<br />
White Percentage : <cfoutput>#aSummaryInformation.RacePercentages.White#</cfoutput>%<br />
Mixed Percentage : <cfoutput>#aSummaryInformation.RacePercentages.Mixed#</cfoutput>%<br />
Other Race Percentage : <cfoutput>#aSummaryInformation.RacePercentages.Other#</cfoutput>%<br />
</td>
</tr>
</table>
<br /><br />
</cfif>
<!--- Begin ColdFusion Form --->
<cfform name="Form" action="demographics.cfm" method="post">
<table width="400" border="0" cellspacing="0" cellpadding="3">
<tr>
<td align="right">Address:</td>
<td>
<!--- Address textfield - REQUIRED --->
<cfinput
type="text"
name="Address"
size="30"
required="yes"
message="Please enter your Address">
</td>
</tr>
<tr>
<td align="right">City: </td>
<td>
<!--- City textfield - REQUIRED --->
<cfinput
type="text"
name="City"
size="30"
required="yes"
message="Please enter your City">
</td>
</tr>
<tr>
<td align="right">State:</td>
<td>
<!--- State textfield - REQUIRED --->
<cfinput
type="text"
name="State"
size="30"
required="yes"
message="Please enter your State">
</td>
</tr>
<tr>
<td align="right">Zip:</td>
<td>
<!--- State textfield - REQUIRED --->
<cfinput
type="text"
name="Zip"
size="30"
required="yes"
message="Please enter your Zip">
</td>
</tr>
<tr>
<td align="right">&nbsp;</td>
<td>
<!--- Submit button --->
<input type="submit" name="Submit" value="Check Address">
</td>
</tr>
</table>
<!--- End ColdFusion Form --->
</cfform>
</body>
</html>
Personal tools
Namespaces

Variants
Actions
Navigation
Tools

Trial Key