Dropdown Value - Update Error (Parameterized Perspective Popup)

I'm creating a popup that will be passing parameters based on selected row in a table. Labels receive the information fine, but my dropdown value is not updating to the correct value that is coming into the popup.

Log View:
image

Table:

Main View Params:
image

Popup Params:
image

Dropdown Binding:

Example:

I'm sure this is an easy fix just not sure what I am doing wrong here.

What's your script look like that launches the popup?

Maybe you have a case sensitive error or are not passing the parameter to the popup.

Just as a test I made a Popup with a dropdown on it.

The popup takes a parameter called "Param" which I set a default value of 0.
The dropdown has 2 entries. value 0 is "Test" and value 1 is "test23".
I bound the popup's value property to "Param"

I added a button to a screen that runs this script
system.perspective.openPopup('x', 'Popups/temp', {"Param":1})

It correctly changed the description in the dropdown to "test23".

I suspect you're either passing in the label instead of the value or you have a case sensitivity issue on your parameter name.

Hope that helps.

Could be wrong but you may want to bind to 'options' instead of (or in addition to) 'value' on your dropdown. This would require reconfiguring your parameter-passing logic a bit. I have confirmed that leaving an empty array in the 'options' property does not let me set a value.

image

I'd set up a logger with that script and make sure the value you expect to be going into "machine" is the value you're sending. Also, make sure that value is the key for the drop down; not the description.

The options section will have a list of all the values and their descriptions.

It looks like you're passing into the parameter that matches your binding so presumably it is not getting the value you expect to be sending. You could also copy/paste your open popup script and send a hardcoded value to confirm that is working. I believe it is but it's always good to test.

Edit:
Another possibility is that you have more than one version of your popup if you've been working on multiple iterations. Note that you're calling "Popups/RawMaterialForm"

could you give us a json copy of the dropwdown? so we can inspect the bindings

(something that looks like this, but ofc a dropdown and not a markdown, just select the component and copy paste it here, formated)

[
  {
    "type": "ia.display.markdown",
    "version": 0,
    "props": {
      "markdown": {
        "escapeHtml": false
      }
    },
    "meta": {
      "name": "Markdown"
    },
    "position": {
      "x": 288,
      "y": 373,
      "height": 200,
      "width": 200
    },
    "custom": {},
    "propConfig": {
      "props.source": {
        "binding": {
          "type": "expr",
          "config": {
            "expression": "{../TextField.props.text}"
          },
          "transforms": [
            {
              "code": "...",
              "type": "script"
            }
          ]
        }
      }
    }
  }
]

Dropdown:

[
  {
    "type": "ia.input.dropdown",
    "version": 0,
    "props": {
      "options": [
        {
          "label": "Line 11",
          "value": "L11"
        },
        {
          "label": "Line 12",
          "value": "L12"
        },
        {
          "label": "Line 21",
          "value": "L21"
        },
        {
          "label": "Line 22",
          "value": "L22"
        },
        {
          "label": "Line 31",
          "value": "L31"
        },
        {
          "label": "Line 41",
          "value": "L41"
        },
        {
          "label": "Line 51",
          "value": "L51"
        },
        {
          "label": "Line 52",
          "value": "L52"
        },
        {
          "label": "Line 61",
          "value": "L61"
        },
        {
          "label": "Line 62",
          "value": "L62"
        }
      ]
    },
    "meta": {
      "name": "Dropdown"
    },
    "position": {
      "x": 214,
      "y": 87,
      "height": 36,
      "width": 256
    },
    "custom": {},
    "propConfig": {
      "custom.machine": {
        "binding": {
          "config": {
            "expression": "if({view.params.action}=\"add\",\"\",{view.params.machine})"
          },
          "type": "expr"
        }
      },
      "props.value": {
        "binding": {
          "config": {
            "path": "view.params.machine"
          },
          "type": "property"
        }
      }
    },
    "events": {
      "system": {
        "onStartup": {
          "config": {
            "script": "\tself.refreshBinding('self.props.value')"
          },
          "scope": "G",
          "type": "script"
        }
      }
    },
    "scripts": {
      "customMethods": [],
      "extensionFunctions": null,
      "messageHandlers": [
        {
          "messageType": "refreshPopup",
          "pageScope": true,
          "script": "\tself.refreshBinding(\"self.props.value\")",
          "sessionScope": true,
          "viewScope": true
        }
      ]
    }
  }
]

Label (Label Works):

[
  {
    "type": "ia.display.label",
    "version": 0,
    "props": {},
    "meta": {
      "name": "Label_0"
    },
    "position": {
      "x": 599,
      "y": 158,
      "height": 32,
      "width": 50
    },
    "custom": {},
    "propConfig": {
      "props.text": {
        "binding": {
          "config": {
            "path": "view.params.machine"
          },
          "type": "property"
        }
      }
    }
  }
]

I set up labels on the page and the params come through and show up in the labels. It does match the value in the options also. Check out my example it shows the labels receiving the correct information, just for some reason the dropdown does not receive it.

image

Label Property Binding:
image

Dropdown Property Binding:
image

I double checked on the version and it is the correct version.

For a test, try binding the value of your dropdown to the value of the label. You can see the value coming in the label but that would confirm the value is matching a value on the dropdown list. Basically making sure there aren't spaces, etc.

I usually troubleshoot this kind of problem with a logger.

Okay, so the value is there it is just not displaying.
I added a button to send the information to a logger for me to test it out. It doesn't seem like I have any extra spaces. Also, it seems to be matching the value in the options section.

Button Added:

Button Script:

Logger Info:

Options:
image

I normally use integers (ID) for the value. I wonder if it's something with string matching.

It's weird because I made an example on my end and it was behaving like we both suspect.

If you call support you can do a client share session and they can help you troubleshoot it.

I think it is a data type issue. If I put the value like this "L22" it actually puts the value into the dropdown value section with this. code.

Works this route

Variable Method (Does not work):

Datatypes:

I did try putting str around the variable, but that still did not work. Is there another method to convert unicode to a string for this?

When I did my test example before initially responding to you I just had a binding on the dropdown that was pointed to the parameter. I passed in a string and the binding took care of the rest. You would have to add a script transform to do any logging in that method (I didn't log anything when I did my test because it worked)

It kind of looks like the message handler is handling it differently than a binding to the parameter. If you're embedding the view you might need to use the message handler but if you're just doing a popup you should be able to send it as a parameter.

When I get a weird behavior like this I usually just call support.

I just want to say I tried the Int function in scripting and it did not work, but that is probably my issue. I did follow this forum and tried in the expression to convert it to an Int and it did work.

Binding to dropdown to page parameter not working - Ignition - Inductive Automation Forum