I have a mini-automation for Monday that requires to take a Text column with a country Name, and copy it to a Country Column (The type of the column is “Country”)
Generally speaking I would use the following operations:
- List Board Items (Only the Text column with the country name is needed)
- Iterate the results
- Set Variables
- Monday Update Column Values using the Item ID and the Country Name
The twist comes when I need to populate the “Country” Column because it requires a “Country Code” apart from the name:
I found online the list of country codes: http://country.io/names.json and I can use the HTTP module to get the content, although I need the to use the “key” and not the “value” in this case…
I need some help in figuring out the logic of what to do next, I have a reached a mental dead-end
You can use the built-in function
toArray(Data) to convert it to an array,
first(map( )) to filter out the array items by the name, and get the key.
For more information about map, see https://www.make.com/en/help/functions/array-functions#map-complex-array--key--key-for-filtering---possible-values-for-filtering-separated-by-a-comma--
Great technical advices and I completed the task !
I honestly don’t understand 100% what I did but here is how the scenario looks like:
HTPP is getting country code from: http://country.io/names.json
Converting the the array:
Monday - List Board Items
Iterating the entries from Monday
Setting the Monday Item ID and Country Name as Variables
Setting the Variable of the Country Code with the country name as the filter
Updating the Monday board with the country name and country code:
Just for the same of interest, what modules I could have saved? or do this scenario in a more efficient way?
You could remove module  and put that directly in module  “Country Code”, but you need to wrap it with
first( ) so that you get the value, and not an array.
OK, done, and working as you suggested:
Recapping to make sure I understand:
Map() takes the Array obtained in Module 11 and provides the “key”, when the “value” equals to the “Country Name” obtained by the variable:
If every bundle will include only 1 country name, why do I need the “First()” function?
because map can return more than one matched item (array) - when there is more than one item with the same matched value.
to get the first (or only) item, you still need to call
first, or use
get to retrieve a specific item from the array.