cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any service which gives me all the states in US ?

Former Member
0 Kudos

I am trying to populate all us states in a drop down, do we have any built in service which return all the US states ? Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

former_member621020
Active Participant
0 Kudos

Hi Khaja,

I assume you are referring to "regions" as "states"

Data related to regions & countries can be found in countries.impex

 INSERT_UPDATE Country;isocode[unique=true];name[lang=en];active[default=true]
 ;US;"United States"
 
     INSERT_UPDATE Region;country(isocode);isocode[unique=true];isocodeShort;name[lang=en];active[default=true]
     ;US;US-AL;AL;"Alabama"
     ;US;US-AK;AK;"Alaska"
     ;US;US-AZ;AZ;"Arizona"
     ;US;US-AR;AR;"Arkansas"
     ;US;US-CA;CA;"California"
     ;US;US-CO;CO;"Colorado"
     ;US;US-CT;CT;"Connecticut"

You can use the getRegionsForCountryIso method in DefaultI18NFacade

 @Override
     public List<RegionData> getRegionsForCountryIso(final String countryIso)
     {
         final CountryModel countryModel = getCommonI18NService().getCountry(countryIso);
         final List<RegionModel> regions = new ArrayList<RegionModel>(countryModel.getRegions());
         Collections.sort(regions, RegionNameComparator.INSTANCE);
         return Converters.convertAll(regions, getRegionConverter());
     }
Former Member
0 Kudos

Thank you so much Madhavi.

Answers (0)