How-to use Location componentThe Location component serves as a database of several countries and country states around the world. When you install this component it does a bootstrap from the Geo.xls file to the Country and CountryState entities in order to fill them with data.
Here are the entities attributes:
Country Entity
Id - Internal identifier
Code - ISO 3166-1 alpha-2 country code
Name - Country name
CountryDialCode - Country dial code
CountryState Entity
CountryCode - ISO 3166-1 alpha-2 country code
Code - FIPS 10-4 region code
Name - State Name
Abbreviation - State Name Abbreviation
You should have in mind that the country code is what makes the relations between the two entities (all the CountryStates of a certain Country will have his CountryCode).
In your application, you can either use directly these entities or use the actions that the component provides, so let's take a look at them.
Coutry_GetByCode
It receives the country code as input and returns you a record of the entity Country.
Country_GetById
Receives the country identifier as input and returns you a record of the entity Country.
Country_GetList
This one doesn’t have any inputs and returns you a list of all Country records and the total number of records returned.
Country_HasStates
So instead of rushing to get the country states, you can also see if the country has any states. This action receives the country identifier and returns you true or false if the current country has country states or not.
Country_GetStates
Now assuming that the country has states you can always use this action sending the country id to get the list of CountryState records.
CountryState_GetCountryStateListByCountryCode
This action also returns you the list of CountryState records but also returns the number of records and the previous one doesn’t, and instead of receiving the country id it receives the country code.