Lookup function

Hi,

I am looking to create a lookup function that will allow locations to appear on a map.

the general principle is that data I am trying to use comes with lat and long detail therefore getting it onto a map in principle is fairly straightforward as it comes from a database and is feed from an API.

the challenge I have is that the data from the API comes with a location tag I.e it is part of a regional area and I need it to match into a high level region in the hierarchy.

E.g data comes with a location of Dublin South and I need it to match to a region called East.

I have about 30-40 locations that’s I need to match into 4 regions.

the 4 regions are specifically used in this case as it matches all the other data within the system.

is it best to create a lookup in the database and pull it through or should I use some scripting to do it?

Im a novice to scripting so would appreciate any guidance to make this as straightforward as possible.

Do this task in the initial DB Query.
This is a classic example where you would have a table of locations that has two columns, location and region, you would then left-join your query for the initial location with this table to add a column to your results with the correct region for the location. This then stays as a single SQL query.

1 Like