I am creating an HMI that will have 5 different tablets using it, with a drop down of a lot of machine numbers. Is there anyway I can have the drop down of machine number options vary depending on which HMI is being used?
I already have the HMIs set up dynamically so they can all tell which one they are based on their own IP address.
I have a drop down list of 30 or more machines but I need the drop down to only be the 5 machines relevant to the tablet using the program... if that makes sense.
Yes. The tablets currently know which machine they are tied to by looking at their own IP address and comparing that to a SQL table with the IPs and machine numbers on it
It's still not clear where you are stuck.
You would need a named query along the lines of,
SELECT
machineNum AS value,
machineNum AS label,
FALSE AS isDisabled
FROM machineAccessList
WHERE ipAddress = :ipAddress
ORDER BY machineNum
Set the named query to return the data in JSON format.
On your dropdown, create a query binding on props.options, select the named query above and bind the ipAddress parameter to wherever you have that stored in the session.
The result.
Note that if you add a description column to your table you could use a more descriptive name for the dropdown labels.
SELECT
machineNum AS value,
description AS label,
FALSE AS isDisabled
FROM machineAccessList
WHERE ipAddress = :ipAddress
ORDER BY machineNum
Is there anyway to do this with script? I am trying to avoid creating another "1 off" table if possible. I have been messing around with putting a transform binding on the value and label of the drop down options to look something like this:
and so on with a list of all of the machineIDs and E#s but his would create a lot of separate bindings and long scripts on each of them to cover each machine.
I already have a table that ties the machines to IP address. I just want to tie those machines to a list of presses that are around it, instead of a list of all presses we have.
I don't want to create a table because the presses get moved around and I feel it would be easier to change a script semi-often than to change a table semi-often
Not long term, or for others. Or especially when you are asked to allow management to make the adjustments through a user interface. (You need the designer to change scripts. Any user interface can call database updates.)
Since you already have a table that ties IP to machine, make the new table just tie presses to nearest machine. Then your NQ would join the two tables on machine to get presses for IP address.