# Passing strings to scripts

**URL:** <https://forum.inductiveautomation.com/t/passing-strings-to-scripts/104732>\
**Category:** Ignition\
**Tags:** namedqueries, scripting\
**Created:** [April 4, 2025, 6:00pm UTC](https://forum.inductiveautomation.com/t/passing-strings-to-scripts/104732 "2025-04-04T18:00:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dick.willis](https://avatars.discourse-cdn.com/v4/letter/d/7ea924/32.png) [@dick.willis](https://forum.inductiveautomation.com/u/dick.willis)\
**Post date:** [April 4, 2025, 6:00pm UTC](https://forum.inductiveautomation.com/t/passing-strings-to-scripts/104732/1 "2025-04-04T18:00:54Z")

</div>

I'm using a script to execute a named query. One of the parameters to the named query is a string. I've tested the named query and it works fine. But when I execute from a script, one of the fields does NOT get populated, but is left NULL.

I am guessing my syntax is not right when I'm building the parameter list, because the field that is NOT being populated happens to be the only "string" parameter ... but I couldn't find any reason why it would not get passed in properly to the runnamedquery method.

```python
hrbyhrKey = 36
losttime = 15
freeform = "freeform text 55"
lossKey = 14
workcellKey = 15

paramlist = {"FreeForm":freeform,"HrByHrKey":hrbyhrKey,"LossKey":lossKey,"LostTime_Mins":losttime,"WorkcellGroupMemberKey":workcellKey}
results = system.db.runNamedQuery(path=namedquerypathvalue, parameters=paramlist, getkey=1)

print results

```

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [April 4, 2025, 6:02pm UTC](https://forum.inductiveautomation.com/t/passing-strings-to-scripts/104732/2 "2025-04-04T18:02:19Z")

</div>

Are you sure your parameter names match your query definition **exactly** , including case?

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [April 4, 2025, 6:31pm UTC](https://forum.inductiveautomation.com/t/passing-strings-to-scripts/104732/3 "2025-04-04T18:31:38Z")

</div>

Tips:

- Don't post code as a quotation ". Post it as preformatted text \</\>. Please see [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831).
- Add a space after every punctuation (`,` and `:`) as you would in written English, and both sides of `=`. This will help when text needs to wrap and improve general legibility.

```python
hrbyhrKey = 36
losttime = 15
freeform = "freeform text 55"
lossKey = 14
workcellKey = 15

paramlist = {"FreeForm": freeform, 
  "HrByHrKey": hrbyhrKey, 
  "LossKey": lossKey, 
  "LostTime_Mins": losttime, 
  "WorkcellGroupMemberKey": workcellKey
}
results = system.db.runNamedQuery(path = namedquerypathvalue, 
 parameters = paramlist, getkey = 1)

print results

```

---

<div class="post-metadata">

**Author:** ![dick.willis](https://avatars.discourse-cdn.com/v4/letter/d/7ea924/32.png) [@dick.willis](https://forum.inductiveautomation.com/u/dick.willis)\
**Post date:** [April 4, 2025, 7:30pm UTC](https://forum.inductiveautomation.com/t/passing-strings-to-scripts/104732/4 "2025-04-04T19:30:17Z")

</div>

I sure did think I had checked all that ... but ... I missed one ... FreeForm, Freeform ... so _ **that** _ was the reason, NOT because it was a string. Thanks for the help.

---

<div class="post-metadata">

**Author:** ![dillon](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dillon/32/81537_2.png) [@dillon](https://forum.inductiveautomation.com/u/dillon)\
**Post date:** [April 4, 2025, 7:31pm UTC](https://forum.inductiveautomation.com/t/passing-strings-to-scripts/104732/5 "2025-04-04T19:31:58Z")

</div>

Yeah something like that I would shut the computer off for the weekend lol

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [April 4, 2025, 10:21pm UTC](https://forum.inductiveautomation.com/t/passing-strings-to-scripts/104732/6 "2025-04-04T22:21:54Z")

</div>

Ask me how I knew to check that first thing 😆

Been there, done that.
