How to use prompt variable with if command

hi, i am new with programming, i want to use prompt command to enter a variable (y or n), the variable decides what option to select to be filled, i used if_v2 command, which gives error Error in condition of if_v2: y is not defined.

{
  "Name": "uti-1",
  "CreationDate": "2020-10-22",
  "Commands": [
    {
      "Command": "prompt",
      "Target": "opd yes or no (y/n)",
      "Value": "aaa"
    },
    {
      "Command": "if_v2",
      "Target": "${aaa} === y",
      "Value": ""
    },
    {
      "Command": "select",
      "Target": "name=patientType",
      "Value": "label=OPD",
      "Targets": [
        "name=patientType",
        "xpath=//*[@id=\"tr_ptype\"]/td[2]/select",
        "xpath=//select[@name='patientType']",
        "xpath=//tr[2]/td[2]/select",
        "css=#tr_ptype > td:nth-child(2) > select"
      ]
    },
    {
      "Command": "end",
      "Target": "",
      "Value": ""
    },
    {
      "Command": "if_v2",
      "Target": "${aaa} === n",
      "Value": ""
    },
    {
      "Command": "select",
      "Target": "name=patientType",
      "Value": "label=In-Patient",
      "Targets": [
        "name=patientType",
        "xpath=//*[@id=\"tr_ptype\"]/td[2]/select",
        "xpath=//select[@name='patientType']",
        "xpath=//tr[2]/td[2]/select",
        "css=#tr_ptype > td:nth-child(2) > select"
      ]
    },
    {
      "Command": "end",
      "Target": "",
      "Value": ""
    }
  ]
}

any help will be appreciated, thanks

Just a small issue: Instead of

${aaa} === y

use

${aaa} === "y"

2 Likes