Dropdown Default Value

Hello,
New to Ignition

Hope everyone is well,
i have two drop down menus, one selects the variable name i want to write to and the other is the variable value, the first defaults to the first in the list, but the second i want to display the value from the variable, i cant figure out how this is done, any ideas would be great thank you.

You would use indirect binding on the second component. But it will be very complicated if the choices for the second component vary per variable allowed.

If I'm reading this right, your first drop down alters what appears in the second drop down ?

If your info is in a database you can use a named query on the second drop down using the first drop down as the parameter.

https://docs.inductiveautomation.com/display/DOC81/Named+Queries

Hi Thanks for the relays. Sorry only new to ignition so didn't realy explain very well.

Dropdown one is set up as indirect, it selects different motors within a PLC eg motor 1 motor 2 motor 3. Then below the motors is some guages with RPM temp and so on for that motor set and these change based on the motor set selected. The second drop down sets the motor speed. 3 pre set mixing speeds 750 RPM 1500RPM 2000 RPM, so what I want to happen is when you select motor drop down the other drop down charges to the current RPM setting.

Hope this is clearer.

Why not use the indirect binding technique on the second dropdown as well?

See Perspective indirect tag binding.

I have and it sets the variable as wanted. But when you select the first dropdown I want the second drop down to show what it is set to.

If you've got the indirect tag binding setup correctly on the 2nd dropdown, you should correctly see the value of the selected motor in dropdown 1. Screenshots speak 1000 words :slight_smile:

Hi everything is set up correctly from what I can see, dropdown 1 changes the variable / motor selection and Dropdown 2 sets the speed and writes to the PLC. No issues.

But when you change dropdown one the second dropdown where you set the RPM goes back to the placeholder text. Even though the Varable has RPM already set.

I'll take some screens shots tomorrow if needed

Sounds like the rpm value isn't in the list, or your list value is a different type to the tag's value. E.g. It's a string perhaps?

Nope because it all works.eg. you select motor set 3 from dropdown then set 750RPM from dropdown 2 this writes to the PLC no issues select motor 1 and the swap back straight back to motor 3 and it just displays the placeholder. Not the set value and 750rpm INT is still in the PLC.

It'll still write the value correctly if it's a string in the dropdown as it'll convert it implicitly, it just may not display it correctly

1 Like

Paste the JSON for your Dropdown2 options list so we can see what's going on.

Anyway, it doesn't sound like a good machine GUI. If anyone adds or sets a different RPM on the motor then your HMI will fail. Dropdowns are not usually used for industrial control user interfaces.

To get up to date on current HMI design recommendations have a look at High Performance HMI Design Basics on YouTube.

nminchin, make sense, if it is a string how do I change it from string to INT.

Transistor. How do I download the json file, as said only new.

And the RPM is only set by one operator from one place. No one else has access.

Right-click on props.options and select Copy.
Paste into your post and format it as code using the </> button. It should look something like this:

[
  {
    "value": "600",
    "label": "600 RPM"
  },
  {
    "value": "900",
    "label": "900 RPM"
  },
  ...
]

I'll be in front of my computer in an hour I'll take screen shots and copy paste code.

Thanks for the help.

I'll be asleep in Ireland. Good night.

I'll be here, not sleeping, very much awake :face_with_spiral_eyes: Start of my Monday

Here is the prop.options for both the dropdowns



#Dropdown 1
[
  {
    "value": 3,
    "label": "Hopper 3"
  },
  {
    "value": 4,
    "label": "Hopper 4"
  },
  {
    "value": 5,
    "label": "Hopper 5"
  },
  {
    "value": 6,
    "label": "Hopper 6"
  }
]

#Dropdown 2
[
  {
    "value": 0,
    "label": "Stop"
  },
  {
    "value": 750,
    "label": "Slow Speed"
  },
  {
    "value": 1500,
    "label": "Medium Speed"
  },
  {
    "value": 2000,
    "label": "High Speed"
  },
]

Dropdown 1 action

Dropdown 2 action