Popup, parameters, named query, part 2

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

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

The component bound to custom array property:

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.

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:

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

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

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

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

Phil showed me this syntax

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

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

This is the error I get

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.

1 Like

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.

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

Error performing subscript operation.

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

2 Likes

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

try:

except:

syntax either

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

1 Like

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

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

I tell you, Phil, Access seems much simpler! :slight_smile:

image

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

Well I’ll be…

that works too!

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

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.

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.