# Popup, parameters, named query, part 2

**URL:** <https://forum.inductiveautomation.com/t/popup-parameters-named-query-part-2/64506>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [September 26, 2022, 9:11pm UTC](https://forum.inductiveautomation.com/t/popup-parameters-named-query-part-2/64506 "2022-09-26T21:11:07Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![mdemaris](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdemaris/32/54639_2.png) [@mdemaris](https://forum.inductiveautomation.com/u/mdemaris)\
**Post date:** [September 26, 2022, 9:11pm UTC](https://forum.inductiveautomation.com/t/popup-parameters-named-query-part-2/64506/1 "2022-09-26T21:11:07Z")

</div>

Hello all,

Following on the tails of this thread, since I marked it as solved, but came across a different problem:  
[https://forum.inductiveautomation.com/t/popup-view-parameter-stored-procedure/64354/5](https://forum.inductiveautomation.com/t/popup-view-parameter-stored-procedure/64354/5)

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

If I hard code the parameter value then I can get a row of data and populate into the other components. IF, I bind the value to the `view.params.p_item` then it does not work.

p\_item gets the value passed from an on row click event via `event.valuve["ItemID"]`.  
I bound one label to p\_item. Then, created a custom property in the view, bound to the named query in the image. (I marked the previous thread as solved because I was able to get data into each component, but that only seems to work if I hard code the queries parameter value.)

So, if I can’t use the view.param.p\_item to pass into the query, and I can’t use a bound components value, what can I use?

The view’s params and custom array property:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/e/be9dd72423a5fb62932c5a56dd85dff605de587d.png)

The component bound to custom array property:

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

---

<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 26, 2022, 9:19pm UTC](https://forum.inductiveautomation.com/t/popup-parameters-named-query-part-2/64506/2 "2022-09-26T21:19:04Z")

</div>

It looks like you are trying to bind from the query result to use in the query’s own parameters? You can’t circularly bind like that (well, not without extreme difficulty). Use separate queries, if necessary, to provide options to pick from.

Or just make your user type in the catalog number.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [September 26, 2022, 10:44pm UTC](https://forum.inductiveautomation.com/t/popup-parameters-named-query-part-2/64506/3 "2022-09-26T22:44:13Z")

</div>

you can use `p_item`, but make sure to “commit” you parameter changes in the Expression input in the binding dialog; you have to actually press Enter to commit typed text.

Before hitting Enter, and even after clicking around in the dialog:

 ![Screen Shot 2022-09-26 at 3.42.35 PM](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/f/0ffdab3e007a479d4e50d4febdd1afc5c4caa624.png)

After hitting Enter to “commit” the selected property from the property browser popover:

 ![Screen Shot 2022-09-26 at 3.42.47 PM](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/d/0d66314525871897e61f890bcb7e35a8e915b923.png)

---

<div class="post-metadata">

**Author:** ![mdemaris](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdemaris/32/54639_2.png) [@mdemaris](https://forum.inductiveautomation.com/u/mdemaris)\
**Post date:** [September 27, 2022, 12:35am UTC](https://forum.inductiveautomation.com/t/popup-parameters-named-query-part-2/64506/4 "2022-09-27T00:35:09Z")

</div>

Item ID from View1 into popup param: p\_item.

popup custom prop array (a\_item), takes p\_item as a parameter for named query.

query should return 1 row of data and fill a\_item.

other components in the popup should be able to bind text prop to a\_item data points, as in

```auto
{view.custom.a_item}[0, 'CatalogNumber']

```

@cmallonee pressing enter did allow the property to be committed, thank you.

Phil showed me this syntax

```auto
{view.custom.a_item}[0, 'CatalogNumber']

```

on the other thread, but I feel like something else broke.

This is the error I get

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

I don’t know why it doesn’t like it now. Does not make sense.

FYI - i created a new view with a table, same data, and new popup than what was used in the first post, so I could add one component/property/binding at a time and try and find what the issue is.

---

<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 27, 2022, 1:06am UTC](https://forum.inductiveautomation.com/t/popup-parameters-named-query-part-2/64506/5 "2022-09-27T01:06:47Z")

</div>

If there is no row in `.a_item` to start with, you should wrap that whole thing with a `try()` expression. That can supply an initial value until `.a_item` is populated.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [September 27, 2022, 3:33am UTC](https://forum.inductiveautomation.com/t/popup-parameters-named-query-part-2/64506/6 "2022-09-27T03:33:15Z")

</div>

You can hover over the error type to get the exact error details

---

<div class="post-metadata">

**Author:** ![mdemaris](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdemaris/32/54639_2.png) [@mdemaris](https://forum.inductiveautomation.com/u/mdemaris)\
**Post date:** [September 27, 2022, 3:58pm UTC](https://forum.inductiveautomation.com/t/popup-parameters-named-query-part-2/64506/7 "2022-09-27T15:58:45Z")

</div>

Error performing subscript operation.

---

<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 27, 2022, 4:00pm UTC](https://forum.inductiveautomation.com/t/popup-parameters-named-query-part-2/64506/8 "2022-09-27T16:00:35Z")

</div>

That’s normal if your dataset is empty. Use the `try()` function around that expression.

---

<div class="post-metadata">

**Author:** ![mdemaris](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdemaris/32/54639_2.png) [@mdemaris](https://forum.inductiveautomation.com/u/mdemaris)\
**Post date:** [September 27, 2022, 4:25pm UTC](https://forum.inductiveautomation.com/t/popup-parameters-named-query-part-2/64506/9 "2022-09-27T16:25:48Z")

</div>

like this: `try({view.custom.a_item}[0,'CatalogNumber'],pass)`

I get a syntax error on right parenthesis.

The expression builder doesn’t seem to like the

```auto
try:

except:

```

syntax either

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [September 27, 2022, 4:34pm UTC](https://forum.inductiveautomation.com/t/popup-parameters-named-query-part-2/64506/10 "2022-09-27T16:34:24Z")

</div>

Because `pass` is not a valid token. Try `"pass"` as a string.

---

<div class="post-metadata">

**Author:** ![mdemaris](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdemaris/32/54639_2.png) [@mdemaris](https://forum.inductiveautomation.com/u/mdemaris)\
**Post date:** [September 27, 2022, 4:35pm UTC](https://forum.inductiveautomation.com/t/popup-parameters-named-query-part-2/64506/11 "2022-09-27T16:35:32Z")

</div>

So, I put a value back into the parameters section…

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

Then ran the session, and it pulls the value from the new records i select.

I tell you, Phil, Access seems much simpler! 🙂

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

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [September 27, 2022, 4:37pm UTC](https://forum.inductiveautomation.com/t/popup-parameters-named-query-part-2/64506/12 "2022-09-27T16:37:15Z")

</div>

Unless you repair the `pass` token, your binding will fault the next time you don’t have a valid value.

---

<div class="post-metadata">

**Author:** ![mdemaris](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdemaris/32/54639_2.png) [@mdemaris](https://forum.inductiveautomation.com/u/mdemaris)\
**Post date:** [September 27, 2022, 4:40pm UTC](https://forum.inductiveautomation.com/t/popup-parameters-named-query-part-2/64506/13 "2022-09-27T16:40:34Z")

</div>

Well I’ll be…

that works too!

---

<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 27, 2022, 4:45pm UTC](https://forum.inductiveautomation.com/t/popup-parameters-named-query-part-2/64506/14 "2022-09-27T16:45:56Z")

</div>

> [@mdemaris](#):
>
> I tell you, Phil, Access seems much simpler!

You'll change your mind when you get over the newbie hump.

> [@cmallonee](#):
>
> Unless you repair the `pass` token

If your catalog number is actually a number (your NQ param is an int), then the `try()` fallback should also be a number. `try()` needs to deliver the same datatype as the working expression would deliver.

---

<div class="post-metadata">

**Author:** ![mdemaris](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdemaris/32/54639_2.png) [@mdemaris](https://forum.inductiveautomation.com/u/mdemaris)\
**Post date:** [September 27, 2022, 4:49pm UTC](https://forum.inductiveautomation.com/t/popup-parameters-named-query-part-2/64506/15 "2022-09-27T16:49:04Z")

</div>

This portion of the popup is for viewing only, so I put a string “none” in the fallback.

And, thanks to all of you, I’ve climbed this mole hill. Next challenge, adding components that take user input and push that data into the DB.
