I am trying to create a lookup table that is linked to my SQL database. I have a database where part stats are saved. I want to be able to search a specific work order and see that parts that are in the work order and see specific stats about each part and I want to see cumulative stats (fail rate, total parts, stuff like that).
I am not sure the best/most efficient way to do this. I saw another topic about potentially using a python script, but I feel like there is a better way to do this.
I now have it all setup so I can pull in data from my SQL and display it in a table. I still have another question though. How do I map a query parameter to a input box? I want to let the user type in a workorder and see all the parts from that work order
You can pass the value of the input directly as a parameter to the query, but I don't recommend this, as the reference can break if you ever rearrange the component layout holding that input (or the table the query is bound to).
The Value type should be used whenever a Named Query needs a dynamic WHERE clause. These act like values passed to a prepared statement, meaning they can never be used to parameterize column or table names. However, they are resilient to SQL injection attacks.
Example:
SELECT *
FROM mytable
WHERE name = :myParam
QueryStrings are more flexible than the Value type in that they can be used to parameterize column and table names. However, their values are never sanitized, which causes them to be more susceptible to SQL injection attacks. When using QueryStrings, it is best to avoid situations where the user can manually type in the value that will be passed to the Name Query.
Just make sure you have the view itself selected, not the root or any other component within it (you can create custom properties for those, but I don't recommend it, for the reason I stated about relative references potentially breaking when you rearrange components).