Country to ISO code converter

Hey all,

Looking for a way to do a basic text expansion where I select a country from a dropdown and it converts it to the ISO3 code (a three letter code that is used for each country). I have that full list (about 190 countries with their codes) in Excel but am wondering if anyone has ideas on how I could create this. Basically, I want to be able to type a shortcut, have it popup a window asking for some info (a disaster type, the country, and the year) then convert to a string that shortens the country to the ISO code and appends the year.

Any help or ideas would be really appreciated! Thanks

In a Prompt for User Input action (KM Wiki), you can display one value, but set the Variable to a different value.
See How to Store a Different Value than Displayed.

So, in Excel you can build the default value list for the Prompt, which is one line with each choice separated by a "|". Then Set a Variable to this list, and use that Variable as the default value for the Prompt.

If this is not clear, let me know and I'll find an example for you.

1 Like

thanks so much for your response! i think i get what you’re saying but would love an example if you have it. the part im not clear on is the last part. if i do a merge where i combine the two columns with a pipe separating the two values, do i just paste that new column into KM somehow or is there a csv input method?

Actually, I just figured it out using a concat and then pasting the final value into it. Thanks again for your help!


Great! If you don't mind sharing, perhaps you could post your finished, working macro. It sounds like a macro, or parts of it, is one that many might be interested in.

Sure thing! As context for what this is being used for... I work in disaster response and my team uses Slack. For each response I want to quickly create a standard channel that uses a set naming scheme: d(to organize on your channel sidebar) + the year of the disaster + the location (shortened and standardized using iso codes, since working in GIS it is easier to connect one record to another using that standardization) + the disaster classification. So using the ",channel" shortcut asks for that data and pumps out, for example, "d17-bgd-tc". I know this is a very niche use, but hopefully others can use the iso code lookup you helped me out with!

New Slack Disaster Channel.kmmacros (6.7 KB)