calitho Posted July 9, 2010 Posted July 9, 2010 Just thought I would share... theValue=Field("State"); if (theValue =="Alambama"){ return("AL"); } else if (theValue == "Alaska"){ return("AK"); } else if (theValue == "Arizona"){ return("AZ"); } else if (theValue == "Arkansas"){ return("AR"); } else if (theValue == "California"){ return("CA"); } else if (theValue == "Colorado"){ return("CO"); } else if (theValue == "Connecticut"){ return("CT"); } else if (theValue == "Delaware"){ return("DE"); } else if (theValue == "District of Columbia"){ return("DC"); } else if (theValue == "Florida"){ return("FL"); } else if (theValue == "Georgia"){ return("GA"); } else if (theValue == "Hawaii"){ return("HI"); } else if (theValue == "Idaho"){ return("ID"); } else if (theValue == "Illinois"){ return("IL"); } else if (theValue == "Indiana"){ return("IN"); } else if (theValue == "Iowa"){ return("IA"); } else if (theValue == "Kansas"){ return("KS"); } else if (theValue == "Kentucky"){ return("KY"); } else if (theValue == "Louisiana"){ return("LA"); } else if (theValue == "Maine"){ return("ME"); } else if (theValue == "Maryland"){ return("MD"); } else if (theValue == "Massachusetts"){ return("MA"); } else if (theValue == "Michigan"){ return("MI"); } else if (theValue == "Minnesota"){ return("MN"); } else if (theValue == "Mississippi"){ return("MS"); } else if (theValue == "Missouri"){ return("MO"); } else if (theValue == "Montana"){ return("MT"); } else if (theValue == "Nebraska"){ return("NE"); } else if (theValue == "Nevada"){ return("NV"); } else if (theValue == "New Hamspire"){ return("NH"); } else if (theValue == "New Jersey"){ return("NJ"); } else if (theValue == "New Mexico"){ return("NM"); } else if (theValue == "New York"){ return("NY"); } else if (theValue == "North Carolina"){ return("NC"); } else if (theValue == "North Dakota"){ return("ND"); } else if (theValue == "Ohio"){ return("OH"); } else if (theValue == "Oklahoma"){ return("OK"); } else if (theValue == "Oregon"){ return("OR"); } else if (theValue == "Pennsylvania"){ return("PA"); } else if (theValue == "Rhode Island"){ return("RI"); } else if (theValue == "South Carolina"){ return("SC"); } else if (theValue == "South Dakota"){ return("SD"); } else if (theValue == "Tennessee"){ return("TN"); } else if (theValue == "Texas"){ return("TX"); } else if (theValue == "Utah"){ return("UT"); } else if (theValue == "Vermont"){ return("VT"); } else if (theValue == "Virginia"){ return("VA"); } else if (theValue == "Washington"){ return("WA"); } else if (theValue == "West Virginia"){ return("WV"); } else if (theValue == "Wisconsin"){ return("WI"); } else if (theValue == "Wyoming"){ return("WY"); } else if (theValue){ return(theValue); } }
rpaterick Posted July 9, 2010 Posted July 9, 2010 Cool thanks. I'll put that in my list of snippets I've collected here. Thanks for sharing....
Dan Korn Posted July 12, 2010 Posted July 12, 2010 I'd do it this way: var StateAbbreviations = { "alabama": "AL", "alaska": "AK", "arizona": "AZ", "arkansas": "AR", "california": "CA", "colorado": "CO", "connecticut": "CT", "delaware": "DE", "district of columbia": "DC", "florida": "FL", "georgia": "GA", "hawaii": "HI", "idaho": "ID", "illinois": "IL", "indiana": "IN", "iowa": "IA", "kansas": "KS", "kentucky": "KY", "louisiana": "LA", "maine": "ME", "maryland": "MD", "massachusetts": "MA", "michigan": "MI", "minnesota": "MN", "mississippi": "MS", "missouri": "MO", "montana": "MT", "nebraska": "NE", "nevada": "NV", "new hamspire": "NH", "new jersey": "NJ", "new mexico": "NM", "new york": "NY", "north carolina": "NC", "north dakota": "ND", "ohio": "OH", "oklahoma": "OK", "oregon": "OR", "pennsylvania": "PA", "rhode island": "RI", "south carolina": "SC", "south dakota": "SD", "tennessee": "TN", "texas": "TX", "utah": "UT", "vermont": "VT", "virginia": "VA", "washington": "WA", "west virginia": "WV", "wisconsin": "WI", "wyoming": "WY", }; var theValue = Field("State"); return StateAbbreviations[ToLower(theValue)] || theValue;
Recommended Posts
Archived
This topic is now archived and is closed to further replies.