Hello all,
I think this one should be easy but I'm a bit stumped.
I need to use a button to fire a named query which will return only one result and insert that result into a text field. I do not want to bind the text property of the text field to the named query because I want to control when it runs, which is why I am adding the script to the button.
Here is the query:
SELECT cartID
FROM CommTrackCarts
WHERE startBuild = (
SELECT MAX(startBuild) FROM CommTrackCarts
WHERE cartNumber = :cartNumberParam )
And here is the script inside of my button:
params = {
"cartNumberParam": event.source.parent.getComponent('Cart').text
}
system.db.runNamedQuery("INSERT Cart", params)
event.source.parent.getComponent('CartID').text = str(system.db.runNamedQuery("SELECT MAX", params))
Right now, this places the dataset into the text field and I need it to return a specific item from the dataset:
Any and all help is greatly appreciated!