# Named query returning empty dataset on table startup

**URL:** <https://forum.inductiveautomation.com/t/named-query-returning-empty-dataset-on-table-startup/112248>\
**Category:** Ignition\
**Tags:** ignition81, scripting, perspective\
**Created:** [November 18, 2025, 11:36am UTC](https://forum.inductiveautomation.com/t/named-query-returning-empty-dataset-on-table-startup/112248 "2025-11-18T11:36:32Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![sanjanakrishnamurthy](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@sanjanakrishnamurthy](https://forum.inductiveautomation.com/u/sanjanakrishnamurthy)\
**Post date:** [November 18, 2025, 11:36am UTC](https://forum.inductiveautomation.com/t/named-query-returning-empty-dataset-on-table-startup/112248/1 "2025-11-18T11:36:32Z")

</div>

Hi,

So, I have a table in a popup which is supposed to receive the results of a named query, written on startup. I’m receiving an empty dataset but on testing the named query, it runs perfectly. Tried the query binding method, which also worked perfectly but on table’s onStartup, the below script is running but the dataset being returned is empty. Am I missing something?

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

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/5/c570ad4819e5fe0ab444a7c4ccd534577cbbec61.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/7/17b1b961fa2fea21f72233ad952950f3c763aac2.png)

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [November 18, 2025, 12:42pm UTC](https://forum.inductiveautomation.com/t/named-query-returning-empty-dataset-on-table-startup/112248/2 "2025-11-18T12:42:46Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/f/6f4d8d3eb590f44fde99868e1bb5a32e3834e82c.png)

I believe if you turn this logger (it may be a different named query logger hopefully someone knows which) to debug, you will see the named query calls and it’s params logged to the gateway. I would start there to confirm that your parameters are exactly as you expect, there’s no hidden white spaces etc.

Edit: Wait I see this is on a runAction script? Show what extension function/setup you are using exatly here. Not to mention it seems like you are just doing a named query with a param - I don’t see why you shouldn’t do a named query binding on the data property. You can use `trim()` in an expression to do the same thing as `.strip()`

---

<div class="post-metadata">

**Author:** ![sanjanakrishnamurthy](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@sanjanakrishnamurthy](https://forum.inductiveautomation.com/u/sanjanakrishnamurthy)\
**Post date:** [November 18, 2025, 1:29pm UTC](https://forum.inductiveautomation.com/t/named-query-returning-empty-dataset-on-table-startup/112248/3 "2025-11-18T13:29:04Z")

</div>

1. i’m not going the binding way because i need to update the table on click of a button. so adding a binding would just keep rebinding the table with the dataset.
2. where do i turn what logger to debug?
3. ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/f/ff988ac644db7212740a183a8b932ac0571efd3a.png) This is onStartup for a table

---

<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:** [November 18, 2025, 1:30pm UTC](https://forum.inductiveautomation.com/t/named-query-returning-empty-dataset-on-table-startup/112248/4 "2025-11-18T13:30:31Z")

</div>

You could utilize this function to log information to the Gateway's wrapper log for debugging

[system.util.getLogger | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-util/system-util-getLogger)

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [November 18, 2025, 1:38pm UTC](https://forum.inductiveautomation.com/t/named-query-returning-empty-dataset-on-table-startup/112248/5 "2025-11-18T13:38:41Z")

</div>

If it’s on button press then doing this on start up makes no sense anyways regardless of the fact that it’s now working now.

What you should do if you want it like this - on button press -

1. Get the params (PartNumAssemblyCode.strip())

2. Run the named query

3. Assign the result to the table data prop.

I wouldn’t do anything in your onStartUp.

Make the table props.data a named query with a hard coded `'’` param (or a param that would yield all rows if that’s reasonable I am guessin you are using a LIKE query), and put polling on 0 - so it loads up when the pages loads but is not refreshing.

If you need it to load with a certain subset/param for the NQ but then still only change on button press, make an additional custom proprety `initialNQParam` that calculates the param you should use for when the table first starts and use that in your named query binding - but keep polling 0 and make initialNQParam static (maybe its a view param or an expression that is non-changing). Then your button press logic handles all subsequent updates.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [November 18, 2025, 1:45pm UTC](https://forum.inductiveautomation.com/t/named-query-returning-empty-dataset-on-table-startup/112248/6 "2025-11-18T13:45:38Z")

</div>

> [@sanjanakrishnamurthy](#):
>
> i need to update the table on click of a button

You can refresh the binding. Just get a reference to the table and call refreshBinding.

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [November 18, 2025, 1:47pm UTC](https://forum.inductiveautomation.com/t/named-query-returning-empty-dataset-on-table-startup/112248/7 "2025-11-18T13:47:52Z")

</div>

I think though he doesn’t want it to auto-refresh which it would do if the param changed right?

---

<div class="post-metadata">

**Author:** ![sanjanakrishnamurthy](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@sanjanakrishnamurthy](https://forum.inductiveautomation.com/u/sanjanakrishnamurthy)\
**Post date:** [November 18, 2025, 2:15pm UTC](https://forum.inductiveautomation.com/t/named-query-returning-empty-dataset-on-table-startup/112248/8 "2025-11-18T14:15:26Z")

</div>

i hope that video helps to get to know what i’m trying to do..

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [November 18, 2025, 2:20pm UTC](https://forum.inductiveautomation.com/t/named-query-returning-empty-dataset-on-table-startup/112248/9 "2025-11-18T14:20:58Z")

</div>

Why don’t you write out the user story here.

What is the user supposed to do and what exactly do you expect to happen at each step.

---

<div class="post-metadata">

**Author:** ![sanjanakrishnamurthy](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@sanjanakrishnamurthy](https://forum.inductiveautomation.com/u/sanjanakrishnamurthy)\
**Post date:** [November 18, 2025, 2:27pm UTC](https://forum.inductiveautomation.com/t/named-query-returning-empty-dataset-on-table-startup/112248/10 "2025-11-18T14:27:08Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/6/96e4fc4752987f646b3bb7feac74ca7d0fbf704f.png)

which opens this popup -

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/6/b64966f093d6249b4b0f6300bed91def20ac264e.png)

which is supposed to look like -

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/d/ad3f4ca3408a671956aaa397540b9bee7e4de472.png)

where they need to edit each cell, update the db on click of the update button

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [November 18, 2025, 2:28pm UTC](https://forum.inductiveautomation.com/t/named-query-returning-empty-dataset-on-table-startup/112248/11 "2025-11-18T14:28:51Z")

</div>

Since it looks like in the popup the part number/assembly code is disabled (since they picked it from the main view - that makes sense)

![image](https://us1.discourse-cdn.com/inductiveautomation/optimized/3X/a/2/a233f7d552b684df5e3aa20127ac7b6317f42d2b_2_690x43.png)

I 100% would just make the table a named query binding with a parameter bound to `trim({path.to.partNo})` and polling 0.

---

<div class="post-metadata">

**Author:** ![sanjanakrishnamurthy](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@sanjanakrishnamurthy](https://forum.inductiveautomation.com/u/sanjanakrishnamurthy)\
**Post date:** [November 18, 2025, 2:38pm UTC](https://forum.inductiveautomation.com/t/named-query-returning-empty-dataset-on-table-startup/112248/12 "2025-11-18T14:38:13Z")

</div>

so i got it working with the binding, but i still haven’t figured out why the startup script didn’t return the right result?

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [November 18, 2025, 2:46pm UTC](https://forum.inductiveautomation.com/t/named-query-returning-empty-dataset-on-table-startup/112248/13 "2025-11-18T14:46:52Z")

</div>

Probabbly because the onStartup, fired prior to the parameter resolving to its proper value.
