Zip code

The post below has the right question, but I’m seeking an updated response for helping me do the same with AI. Has anyone achieved this? If so, how?

Prior Q&A:

Can we use zip codes to identify city/state location?
I have a list of countries in my app, but cities are too abundant to list. Anyone know if we can use zip code to identify city/state? All US…

You could probably create a JSON object, or some kind of delimited list of all city/state/zip combinations, pass that as input into a custom component, and have it generate a dropdown.

1 Like

Thanks @Jeff_Hager

I’d like the user to put in a zip and it automagically generates/fills in the city and state fields. Do your guidance change at all, knowing this? Or is it the same?

What if your ZIP code isn’t unique across countries? Say I search for a random number like 4000, it shows me both Liège, Belgium and Brisbane, Australia.

Other experts will have more insight, but I believe the best approach for this would be to use an API to retrieve the City State based on the inputted Zip code.

Like ThinhDinh just mentioned, you need to consider localization.

It doesn’t change my suggestion. The main consideration is the size of the JSON data and keeping it up to date. There are several versions of some premade JSON out there if you do a search, but it may or may not fit into an entire cell. If I recall, a cell is limited to 1 million characters or something like that. Then you have to consider if you are doing it for other countries as well as the others have pointed out.

I think @Atom makes a good point though about using an API though. The results would always be current.

Just bouncing some ideas. This isn’t something i’ve attempted myself.

2 Likes

Will look into API, thank you.

Clarification, this would be localized for only 5 U.S. states - so less of a data set.

Could probably just make a Glide table and manually copy paste the zips.

Bonus points: Add a button on the front end to submit a ZIP code for review, if the ZIP code entered doesn’t match any in the custom table.

3 Likes

Yeah, if there aren’t too many, I would suggest a table like @Atom said.

State City ZIP Code
California Los Angeles 90001
California San Francisco 94102
California San Diego 92101
California Sacramento 94203
California Fresno 93722
Texas Houston 77001
Texas Austin 73301
Texas Dallas 75201
Texas San Antonio 78201
Texas Fort Worth 76101

But for some states, there can be thousands of them. Please explore the JSON method as an alternative.

2 Likes

Thank you, all! Super helpful to have this community.

1 Like