# Issue with lookup() in tag change script

**URL:** <https://forum.inductiveautomation.com/t/issue-with-lookup-in-tag-change-script/96629>\
**Category:** Ignition\
**Tags:** perspective, scripting\
**Created:** [September 30, 2024, 7:53pm UTC](https://forum.inductiveautomation.com/t/issue-with-lookup-in-tag-change-script/96629 "2024-09-30T19:53:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matthew\_Karee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matthew_karee/32/63956_2.png) [@Matthew\_Karee](https://forum.inductiveautomation.com/u/Matthew_Karee)\
**Post date:** [September 30, 2024, 7:53pm UTC](https://forum.inductiveautomation.com/t/issue-with-lookup-in-tag-change-script/96629/1 "2024-09-30T19:53:49Z")

</div>

I'm trying to use lookup() in a tag change script to assign a string value to a memory tag based on the results of a lookup in a dataset tag.

My script is showing an error in the Ignition gateway and is not running.

I suspect it is a syntax error with the way I am referencing the dataset tag. I tried running the script with line 3 commented out (and writing a random value to dl\_fx instead of 'dl\_ID\_line1'), and the script was able to run fine.

For context, [edge]CLICK\_values/Line1/DL\_ID is equal to 4, and the data type of that tag matches the data type of the DL\_ID column in the dataset (both are integers).

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/0/c0190d377c02c77764e7ba90d8db6df45d843c89.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/d/1d5f64e7e3f534da521148f939713dffa583cf32.png)

---

<div class="post-metadata">

**Author:** ![Matthew\_Karee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matthew_karee/32/63956_2.png) [@Matthew\_Karee](https://forum.inductiveautomation.com/u/Matthew_Karee)\
**Post date:** [September 30, 2024, 7:55pm UTC](https://forum.inductiveautomation.com/t/issue-with-lookup-in-tag-change-script/96629/2 "2024-09-30T19:55:05Z")

</div>

Oops, I sent a screenshot of my debugging version of the script.

The value written to dl\_fx in Line 4 should be dl\_FX\_line1

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 30, 2024, 7:55pm UTC](https://forum.inductiveautomation.com/t/issue-with-lookup-in-tag-change-script/96629/3 "2024-09-30T19:55:20Z")

</div>

`lookup()` is an expression function, not a scripting function. You need to extract the key column as a list, then use `.index()`, then retrieve the desire value.
