Finding Path and Extracting Data from Table


I have a table called “Articles” in “MAIN” window, which has two columns - Number and Products, 1850 rows with different products.
The task is when the operator enter the number of the product on the HMI, on a string memory tag to be written the name of the product. So, my problem is I cannot find the path to the table, in order to use getValueAt function to find the corresponding product name. Please advise.

Where are you trying to get a reference to the table from?
This script is only possible, if you want to use that table, by calling a script on a Window (the MAIN window ideally). In which case you can simply use the window component selection function in the script editor to select your articles table data.

If you’re trying to use a tag change script, you would need to run a sql query (or however you’re populating your articles table) within the tag change script which filters out the results based on your product ID. Ideally this would come from a named query

Thank you for your reply, nminchin. My idea was to use a tag change script. If, let’s say the numerical tag that will reference the product has the name “ProductNr”, how such SQL query would look like?

runPrepQuery("SELECT ProductName FROM productTable where ProductNr =?", [ProdNum], sqlDatabaseName)[0]['ProductName']

Of course, you could do error checking to make sure that only 1 row is returned