Entity Custom Fields Value Mapping

Following this to understand how can i map my default values on a field.
https://sambapos.org/en/content/how-integrate-sambapos-post-code-databases

So i have a Custom Field named ZipCode, and a text file with the list of all the zipcodes.
The list is area name with commas and the code. every new line is a new entry.

How do i set this up to get this list as a drop down select when editing/creating new entity.

Here are a few sample lines from my zipcodes text file:
เขตป้อมปราบศัตรูพ่าย 10100
ป้อมปราบฯ,วัดโสมนัส, วัดเทพศิรินทร์,คลองมหานาค,บ้านบาตร 10100
เขตสัมพันธวงศ์ 10100
จักรวรรดิ์, สัมพันธวงค์, ตลาดน้อย 10100
เขต คลองเตย 10110
เขตบางคอแหลม 10120
บางคอแหลม, วัดพระยาไกร, บางโคล่ 10120
เขตยานนาวา 10120
โพงพาง, ช่องนนทรี 10120
เขตสาธร 10120
ยานนาวา, ทุ่งวัดดอน, ทุ่งมหาเมฆ 10120
เขตหนองแขม 10120
เขตพระประแดง 10130
บางกะเจ้า,บางนำผึ้ง,บางกระสอบ, บางพึ่ บางครุ, บางหัวเสือ 10130

Are you asking using a non csv file? If so it is not possible. Is should be CSV (values separated with comma and all lines should have a single entry).

each line has a single entry. but if possible i would like to be able to ignore the commas.

either way. how do i use data from a csv file to generate the values for a custom field ?

I did this for an entity, was simple, only 3 options.

so i need the same thing happening but just from a csv file. or ideally a text file where i use new line for each value and ignore the commas.

So here is my current setup:

Here are the first few lines from my zipcodes.txt file:

“10100 เขตป้อมปราบศัตรูพ่าย”
“10100 ป้อมปราบฯ,วัดโสมนัส, วัดเทพศิรินทร์,คลองมหานาค,บ้านบาตร”
“10100 เขตสัมพันธวงศ์”
“10100 จักรวรรดิ์, สัมพันธวงค์, ตลาดน้อย”
“10110 เขต คลองเตย”
“10120 เขตบางคอแหลม”
“10120 บางคอแหลม, วัดพระยาไกร, บางโคล่”

Each line being a different Value.

It doesnt seem to be working…

Im hoping to have a drop down selection to choose the value on edit screen… something like this example for the field Redeemed.

This tutorial might give you some idea. This is old v3 but it should still work.

https://www.sambapos.org/wiki/doku.php/en/how_to_integrate_sambapos_to_post_code_databases

You can also…

  1. Create a backup.
  2. Run Enable UK Post Code Lookup configuration task.
  3. See which fields are created for customer entity and adjust it for your needs.
  4. If it does not meet your need rollback with your backup.
1 Like

@Jesse Yeah thats the tutorial i was following, but got some very strange results. No drop down at all as well.
Emre’s method makes sense. But im having trouble finding the right tutorial to do that for some reason.

Let’s simplify things a bit then…

lets say here is a sample from my text file that i will use as the source.

“Option 1”
“Option 2”
“Option 3”
“Option 4”
“Option 5”
“Option 6”

So, its not a CSV, line break for each new value…
I dont mind changing this to a csv like “Options 1”, “Option 2” …

So how do we get these predefined values to show up as a drop down select as shown in the example earlier?