# Lookup function

**URL:** <https://forum.inductiveautomation.com/t/lookup-function/109708>\
**Category:** Ignition\
**Created:** [August 13, 2025, 6:11pm UTC](https://forum.inductiveautomation.com/t/lookup-function/109708 "2025-08-13T18:11:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dannyrodden18061983](https://avatars.discourse-cdn.com/v4/letter/d/7ea924/32.png) [@dannyrodden18061983](https://forum.inductiveautomation.com/u/dannyrodden18061983)\
**Post date:** [August 13, 2025, 6:11pm UTC](https://forum.inductiveautomation.com/t/lookup-function/109708/1 "2025-08-13T18:11:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![David\_Stone](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/david_stone/32/79749_2.png) [@David\_Stone](https://forum.inductiveautomation.com/u/David_Stone)\
**Post date:** [August 13, 2025, 6:31pm UTC](https://forum.inductiveautomation.com/t/lookup-function/109708/2 "2025-08-13T18:31:31Z")

</div>

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.
