Dropdown Error with Selected Values

Hello, 

For preface I am using a query expression rule to query information from the database and display that throughout the dropdown and then save the information into a rule input under a FK to be able to reference the databases. 

This error says:

Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function a!dropdownField [line 52]: A dropdown component [label=“Location”] has an invalid value for “value”. All selected values must be present in the choiceValues array, but value was Patrick AFB and choiceValues was [locationRequestedCurrency:,locationProductId:,locationRange:,locationSite:,locationBase:Patrick AFB,locationCountry:USA,locationState:FL,locationCity:Brevard County,id:1]; [locationRequestedCurrency:,locationProductId:,locationRange:,locationSite:,locationBase:White Sands Missle Range,locationCountry:USA,locationState:NM,locationCity:Las Cruces,id:2]; [locationRequestedCurrency:,locationProductId:,locationRange:,locationSite:,locationBase:Hollowman AFB,locationCountry:USA,locationState:NM,locationCity:Alamogordo,id:3]; [locationRequestedCurrency:,locationProductId:,locationRange:,locationSite:,locationBase:Edwards AFB,locationCountry:USA,locationState:CA,locationCity:Kern County,id:4]; [locationRequestedCurrency:,locationProductId:,locationRange:,locationSite:,locationBase:Vandenberg AFB,locationCountry:USA,locationState:CA,locationCity:Lompoc,id:5]; [locationRequestedCurrency:12345,locationProductId:Test,locationRange:Test,locationSite:Test,locationBase:Test Base,locationCountry:Test,locationState:TS,locationCity:Test,id:6].

when I insert "ri!GISDataTypes.locationDataTypes.locationBase" into the Selected Value under the dropdown. This also happens with other dropdowns where its just choice values and labels are put in there statically not using variables

This is the code I am using that has the dropdown specifically:

            a!boxLayout(
              label: "2. Location of Survey:",
              contents: {
                a!richTextDisplayField(
                  label: "Rich Text",
                  labelPosition: "COLLAPSED",
                  instructions: "",
                  value: {
                    "Identify the range, base, city, state ,and country"
                  }
                ),
                a!dropdownField(
                  label: "Location",
                  labelPosition: "ABOVE",
                  placeholderLabel: "Please Select A Value",
                  choiceLabels: local!myValues.data.locationBase,
                  choiceValues: local!myValues.data,
                  saveInto: ri!GISDataTypes.locationDataTypes,
                  validations: {}
                ),
                a!columnsLayout(
                  columns: {
                    a!columnLayout(
                      contents: {
                        a!linkField(
                          label: "Click to add another Location For a Survey",
                          labelPosition: "ABOVE",
                          links: {
                            a!startProcessLink(
                              label: "Click Here",
                              processmodel: cons!Location_Form_Constant_PM
                            )
                          }
                        ),
                        a!radioButtonField(
                          label: "Validation Status",
                          labelPosition: "ABOVE",
                          choiceLabels: {"Valid ", "Not Valid"},
                          choiceValues: {"Valid", "Not Valid"},
                          value: ri!GISDataTypes.validStatus,
                          saveInto: ri!GISDataTypes.validStatus,
                          choiceLayout: "STACKED",
                          validations: {}
                        )
                      }
                    )
                  }
                ),
                a!columnsLayout(
                  columns: {
                    a!columnLayout(
                      contents: {
                        a!dropdownField(
                          label: "Need Type",
                          labelPosition: "ABOVE",
                          placeholderLabel: "--- Select a Value ---",
                          choiceLabels: {"Option 1", "Option 2"},
                          choiceValues: {1, 2},
                          value: ri!GISDataTypes.needType,
                          saveInto: ri!GISDataTypes.needType,
                          validations: {}
                        )
                      }
                    ),
                    a!columnLayout(
                      contents: {
                        a!dateField(
                          label: "Need Date",
                          labelPosition: "ABOVE",
                          value: ri!GISDataTypes.needDate,
                          saveinto: ri!GISDataTypes.needDate,
                          validations: {}
                        )
                      }
                    ),
                    a!columnLayout(
                      contents: {}
                    )
                  }
                )
              },
              style: "STANDARD",
              marginBelow: "STANDARD"
            ),

This is the code of the entire interface:

a!localVariables(
  local!myValues: rule!GIS_GetLocationDetails(active: true()),
  {
a!sectionLayout(
  label: "Geospatial Information and Services Request",
  contents: {
    a!columnsLayout(
      columns: {
        a!columnLayout(
          contents: {
            a!boxLayout(
              label: "1. Customer Identificaiton and Date:",
              contents: {
                a!textField(
                  label: "Customer",
                  labelPosition: "ABOVE",
                  value: ri!GISDataTypes.customer,
                  saveInto: ri!GISDataTypes.customer,
                  required: true,
                  validations: if(
                    len(
                      ri!GISDataTypes.customer
                    ) > 50,
                    "Value may not be longer than 50 characters. You have entered " & len(
                      ri!GISDataTypes.customer
                    ) & " characters.",
                    null
                  )
                ),
                a!dateField(
                  label: "Date",
                  labelPosition: "ABOVE",
                  value: ri!GISDataTypes.date,
                  saveInto: ri!GISDataTypes.date,
                  required: true
                )
              },
              style: "STANDARD",
              marginBelow: "STANDARD"
            ),
            a!boxLayout(
              label: "2. Location of Survey:",
              contents: {
                a!richTextDisplayField(
                  label: "Rich Text",
                  labelPosition: "COLLAPSED",
                  instructions: "",
                  value: {
                    "Identify the range, base, city, state ,and country"
                  }
                ),
                a!dropdownField(
                  label: "Location",
                  labelPosition: "ABOVE",
                  placeholderLabel: "Please Select A Value",
                  choiceLabels: local!myValues.data.locationBase,
                  choiceValues: local!myValues.data,
                  value: ri!GISDataTypes.locationDataTypes.locationBase,
                  saveInto: ri!GISDataTypes.locationDataTypes,
                  validations: {}
                ),
                a!columnsLayout(
                  columns: {
                    a!columnLayout(
                      contents: {
                        a!linkField(
                          label: "Click to add another Location For a Survey",
                          labelPosition: "ABOVE",
                          links: {
                            a!startProcessLink(
                              label: "Click Here",
                              processmodel: cons!Location_Form_Constant_PM
                            )
                          }
                        ),
                        a!radioButtonField(
                          label: "Validation Status",
                          labelPosition: "ABOVE",
                          choiceLabels: {"Valid ", "Not Valid"},
                          choiceValues: {"Valid", "Not Valid"},
                          value: ri!GISDataTypes.validStatus,
                          saveInto: ri!GISDataTypes.validStatus,
                          choiceLayout: "STACKED",
                          validations: {}
                        )
                      }
                    )
                  }
                ),
                a!columnsLayout(
                  columns: {
                    a!columnLayout(
                      contents: {
                        a!dropdownField(
                          label: "Need Type",
                          labelPosition: "ABOVE",
                          placeholderLabel: "--- Select a Value ---",
                          choiceLabels: {"Option 1", "Option 2"},
                          choiceValues: {1, 2},
                          value: ri!GISDataTypes.needType,
                          saveInto: ri!GISDataTypes.needType,
                          validations: {}
                        )
                      }
                    ),
                    a!columnLayout(
                      contents: {
                        a!dateField(
                          label: "Need Date",
                          labelPosition: "ABOVE",
                          value: ri!GISDataTypes.needDate,
                          saveinto: ri!GISDataTypes.needDate,
                          validations: {}
                        )
                      }
                    ),
                    a!columnLayout(
                      contents: {}
                    )
                  }
                )
              },
              style: "STANDARD",
              marginBelow: "STANDARD"
            ),
            a!boxLayout(
              label: "3. Support Needed:",
              contents: {
                a!checkboxField(
                  label: "Survey Types:",
                  labelPosition: "ABOVE",
                  choiceLabels: cons!GIS_Survey_Types_list,
                  choiceValues: cons!GIS_Survey_Types_list,
                  value: ri!GISDataTypes.surveyTypes,
                  saveInto: ri!GISDataTypes.surveyTypes,
                  validations: {}
                ),
                a!textField(
                  label: "Other Type:",
                  labelPosition: "ABOVE",
                  value: ri!GISDataTypes.otherTypes,
                  saveInto: ri!GISDataTypes.otherTypes,
                  refreshAfter: "UNFOCUS",
                  showwhen: ri!GISDataTypes.surveyTypes = "Other",
                  validations: {}
                ),
                a!paragraphField(
                  label: "Support Required: ",
                  labelPosition: "ABOVE",
                  helptooltip: {
                    "Indicate, as specifically as possible, what needs to be done, e.g., Inertial Navigation System [INS] update points, Precision Measurement Equipment Laboratory [PMEL] survey, radar sites, range/calibration targets, aim/impact points, Geodetic/Gravity Base network, Gravity Gradiometry, etc. Also indicate how many points or sites are involved."
                  },
                  value: ri!GISDataTypes.suppRequired,
                  saveInto: ri!GISDataTypes.suppRequired,
                  refreshAfter: "UNFOCUS",
                  required: true,
                  height: "MEDIUM",
                  validations: {}
                )
              },
              style: "STANDARD",
              marginBelow: "STANDARD"
            ),
            a!boxLayout(
              label: "4. Required Data and Accuracies: ",
              contents: {
                a!richTextDisplayField(
                  label: "Rich Text",
                  labelPosition: "COLLAPSED",
                  value: {
                    "Indicate the type of data needed (e.g., geodetic coordinates, astronomic data, azimuths, gravity data, UTM coordinates, etc.); the datums (if other than WGS 84 and EGM 08); and the desired medium for delivery (if other than Excel and .pdf).",
                    char(10),
                    "Examples:",
                    char(10),
                    "    Geodetic coordinates (latitude, longitude, ellipsoid height):",
                    char(10),
                    "        Absolute: 0.5 meter each component relative to WGS 84",
                    char(10),
                    "        Relative: 0.01 meter + 1ppm relative to local network",
                    char(10),
                    "    Elevations (orthometric heights, local vertical datum elevations):",
                    char(10),
                    "        Absolute: 0.5 meter relative to EGM 08 and WGS 84,",
                    char(10),
                    "        0.05 meter relative to local vertical datum",
                    char(10),
                    "        Relative: 0.01 relative to local network",
                    char(10),
                    "    Azimuths: 10 arcsec relative to geodetic/astronomic north",
                    char(10),
                    "    Slant Ranges: 0.02 meter relative to local network",
                    char(10),
                    "    Vertical angles (true, apparent): 10 arcsec relative to local network",
                    char(10),
                    "    Deflection components: 0.5 arcsec relative to FK 6 star catalog and WGS 84",
                    char(10),
                    "    Acceleration of gravity: 50 μGals relative to local absolute/IGSN 71",
                    char(10),
                    "    Gravity Gradiometry: 2 Eotvos, or 0.2μGal/meter",
                    char(10),
                    char(10),
                    "    All at the 95% (2σ) confidence level"
                  }
                ),
                a!paragraphField(
                  label: "Required Data and Accuracies:",
                  labelPosition: "ABOVE",
                  value: ri!GISDataTypes.dataNeeded,
                  saveInto: ri!GISDataTypes.dataNeeded,
                  refreshAfter: "UNFOCUS",
                  required: true,
                  requiredmessage: "",
                  height: "MEDIUM",
                  validations: {}
                )
              },
              style: "STANDARD",
              marginBelow: "STANDARD"
            ),
            a!boxLayout(
              label: "5. Suspenses:",
              contents: {
                a!richTextDisplayField(
                  label: "Rich Text",
                  labelPosition: "COLLAPSED",
                  value: {
                    "Please allow 30 days for planning/scheduling survey activities prior to data acquisition and 30 days after completion of the field survey for reduction, analysis, quality control, etc. If the preferred 30-day buffer before and after data acquisition cannot be honored please justify in paragraph 10."
                  }
                ),
                a!dateField(
                  label: "Date Survey Required:",
                  labelPosition: "ADJACENT",
                  value: ri!GISDataTypes.dateSurvey,
                  saveInto: ri!GISDataTypes.dateSurvey,
                  required: true
                ),
                a!dateField(
                  label: "Date Final Data Survey Required:",
                  labelPosition: "ADJACENT",
                  value: ri!GISDataTypes.dateFinalSurvey,
                  saveInto: ri!GISDataTypes.dateFinalSurvey,
                  required: true
                ),
                a!dateField(
                  label: "Date of Mission (If Applicable):",
                  labelPosition: "ADJACENT",
                  value: ri!GISDataTypes.dateMission,
                  saveInto: ri!GISDataTypes.dateMission,
                  required: true
                )
              },
              style: "STANDARD",
              marginBelow: "STANDARD"
            ),
            a!boxLayout(
              label: "6. Justification:",
              contents: {
                a!richTextDisplayField(
                  label: "Rich Text",
                  labelPosition: "COLLAPSED",
                  value: {
                    "Identify the system/program or operation supported and impact if support is not provided."
                  }
                ),
                a!paragraphField(
                  label: "Justification:",
                  labelPosition: "ABOVE",
                  value: ri!GISDataTypes.justification,
                  saveInto: ri!GISDataTypes.justification,
                  refreshAfter: "UNFOCUS",
                  height: "MEDIUM",
                  validations: {}
                )
              },
              style: "STANDARD",
              marginBelow: "STANDARD"
            ),
            a!boxLayout(
              label: "7. Special Handling Requirements: ",
              contents: {
                a!checkboxField(
                  label: "Handling Requirements",
                  labelPosition: "ABOVE",
                  choiceLabels: {"For Official Use Only", "Limited Distribution",
                  "Proprietary"},
                  choiceValues: {"FOUO", "Limited Distribution",
                  "Proprietary"},
                  value: ri!GISDataTypes.specHandling,
                  saveInto: ri!GISDataTypes.specHandling,
                  choicelayout: "COMPACT",
                  validations: {}
                )
              },
              style: "STANDARD",
              marginBelow: "STANDARD"
            ),
            a!boxLayout(
              label: "8. Security Classification of GI&S Requested:",
              contents: {
                a!checkboxField(
                  label: "Classification",
                  labelPosition: "ABOVE",
                  choiceLabels: {"Unclassified", "Secret","Top Secret","SCI"},
                  choiceValues: {"Unclassified", "Secret", "Top Secret", "SCI"},
                  value: ri!GISDataTypes.classification,
                  saveInto: ri!GISDataTypes.classification,
                  required: true,
                  choicelayout: "COMPACT",
                  validations: {}
                ),
                a!textField(
                  label: "Classification Authority",
                  labelPosition: "ABOVE",
                  value: ri!GISDataTypes.classAuth,
                  saveInto: ri!GISDataTypes.classAuth,
                  refreshAfter: "UNFOCUS",
                  validations: {}
                ),
                a!textField(
                  label: "Downgrading Instructions",
                  labelPosition: "ABOVE",
                  value: ri!GISDataTypes.downInst,
                  saveInto: ri!GISDataTypes.downInst,
                  refreshAfter: "UNFOCUS",
                  validations: {}
                )
              },
              style: "STANDARD",
              marginBelow: "STANDARD"
            ),
            a!boxLayout(
              label: "9. Point(s) of Contact/Requesting Office/Mailing Address(es) for Published Data",
              contents: {
                a!richTextDisplayField(
                  label: "Rich Text",
                  labelPosition: "COLLAPSED",
                  value: {
                    "Indicate what office(s) should receive the published data. If email is preferred delivery method, please annotate below."
                  }
                ),
                a!textField(
                  label: "POC/Requesting Office",
                  labelPosition: "ABOVE",
                  value: ri!GISDataTypes.requestOffice,
                  saveInto: ri!GISDataTypes.requestOffice,
                  refreshAfter: "UNFOCUS",
                  required: true,
                  validations: {}
                ),
                a!sideBySideLayout(
                  items: {
                    a!sideBySideItem(
                      item: a!textField(
                        label: "Rank",
                        labelPosition: "ABOVE",
                        value: ri!GISDataTypes.rank,
                        saveInto: ri!GISDataTypes.rank,
                        refreshAfter: "UNFOCUS",
                        validations: {}
                      ),
                      width: "MINIMIZE"
                    ),
                    a!sideBySideItem(
                      item: a!textField(
                        label: "Name",
                        labelPosition: "ABOVE",
                        value: ri!GISDataTypes.name,
                        saveInto: ri!GISDataTypes.name,
                        refreshAfter: "UNFOCUS",
                        required: true,
                        validations: {}
                      )
                    )
                  }
                ),
                a!textField(
                  label: "Address",
                  labelPosition: "ABOVE",
                  value: ri!GISDataTypes.address,
                  saveInto: ri!GISDataTypes.address,
                  refreshAfter: "UNFOCUS",
                  required: true,
                  validations: {}
                ),
                a!textField(
                  label: "Email",
                  labelPosition: "ABOVE",
                  value: ri!GISDataTypes.email,
                  saveInto: ri!GISDataTypes.email,
                  refreshAfter: "UNFOCUS",
                  required: true,
                  validations: {}
                ),
                a!columnsLayout(
                  columns: {
                    a!columnLayout(
                      contents: {
                        a!textField(
                          label: "DSN",
                          labelPosition: "ABOVE",
                          value: ri!GISDataTypes.dsn,
                          saveInto: ri!GISDataTypes.dsn,
                          refreshAfter: "UNFOCUS",
                          validations: {}
                        ),
                        a!textField(
                          label: "Fax",
                          labelPosition: "ABOVE",
                          value: ri!GISDataTypes.fax,
                          saveInto: ri!GISDataTypes.fax,
                          refreshAfter: "UNFOCUS",
                          validations: {}
                        )
                      }
                    ),
                    a!columnLayout(
                      contents: {
                        a!textField(
                          label: "Commercial Phone",
                          labelPosition: "ABOVE",
                          value: ri!GISDataTypes.comPhone,
                          saveInto: ri!GISDataTypes.comPhone,
                          refreshAfter: "UNFOCUS",
                          validations: {}
                        ),
                        a!textField(
                          label: "Secure Phone",
                          labelPosition: "ABOVE",
                          value: ri!GISDataTypes.secPhone,
                          saveInto: ri!GISDataTypes.secPhone,
                          refreshAfter: "UNFOCUS",
                          validations: {}
                        )
                      }
                    ),
                    a!columnLayout(
                      contents: {
                        a!textField(
                          label: "Cell Phone",
                          labelPosition: "ABOVE",
                          value: ri!GISDataTypes.cellPhone,
                          saveInto: ri!GISDataTypes.cellPhone,
                          refreshAfter: "UNFOCUS",
                          validations: {}
                        )
                      }
                    )
                  }
                ),
                a!checkboxField(
                  label: "Report Delivery",
                  labelPosition: "ABOVE",
                  choiceLabels: {"Mail", "Email"},
                  choiceValues: {"Mail", "Email"},
                  value: ri!GISDataTypes.deliveryType,
                  saveInto: ri!GISDataTypes.deliveryType,
                  required: true,
                  choicelayout: "COMPACT",
                  validations: {}
                )
              },
              style: "STANDARD",
              marginBelow: "STANDARD"
            ),
            a!boxLayout(
              label: "10. Additional Remarks",
              contents: {
                a!paragraphField(
                  label: "Additional Remarks:",
                  labelPosition: "ABOVE",
                  helptooltip: "Include anything that may clarify the requirement, restrictions on the data or survey activities, and individual(s) we may contact for questions or assistance.",
                  value: ri!GISDataTypes.additionalInfo,
                  saveInto: ri!GISDataTypes.additionalInfo,
                  refreshAfter: "UNFOCUS",
                  validations: {}
                )
              },
              style: "STANDARD",
              marginBelow: "STANDARD"
            ),
            a!columnsLayout(
              columns: {
                a!columnLayout(
                  contents: {
                    a!buttonArrayLayout(
                      buttons: {
                        a!buttonWidget(
                          label: "Cancel",
                          value: true(),
                          saveinto: ri!cancel,
                          submit: false,
                          style: "SECONDARY"
                        )
                      },
                      align: "START"
                    )
                  }
                ),
                a!columnLayout(
                  contents: {
                    a!buttonArrayLayout(
                      buttons: {
                        a!buttonWidget(
                          label: "Submit",
                          submit: true,
                          style: "PRIMARY"
                        )
                      },
                      align: "END"
                    )
                  }
                )
              }
            )
          }
        )
      }
    )
  }
)
}
)

  Discussion posts and replies are publicly visible

Parents
  • Did you try to change

    value: ri!GISDataTypes.locationDataTypes.locationBase,
    saveInto: ri!GISDataTypes.locationDataTypes,

    to

    value: ri!GISDataTypes.locationDataTypes,
    saveInto: ri!GISDataTypes.locationDataTypes,

    This is the reason for the error message.

  • Yes I have tried both and to no avail it doesn't work unfortunately

  • a!localVariables(
      local!locations: {
        {locationRequestedCurrency: null, locationProductId: null, locationRange: null, locationSite: null, locationBase: "Patrick AFB", locationCountry: "USA", locationState: "FL", locationCity: "Brevard County", id: 1},
        {locationRequestedCurrency: null, locationProductId: null, locationRange: null, locationSite: null, locationBase: "White Sands Missle Range", locationCountry: "USA", locationState: "NM", locationCity: "Las Cruces", id: 2}
      },
      local!selected,
      {
        a!dropdownField(
          label: "Dropdown",
          labelPosition: "ABOVE",
          placeholderLabel: "--- Select a Value ---",
          choiceLabels: local!locations.locationBase,
          choiceValues: local!locations,
          saveInto: local!selected,
          value: local!selected,
          validations: {}
        )
      }
    )

    Tried to make it a small working example. With dropdown fields, it is important to have the selected value in the list of available values and data types must match. This is what the error message tries to tell you

    but value was Patrick AFB and choiceValues was [locationRequestedCurrency:,locationProductId:,locationRange:,locationSite:,locationBase:Patrick AFB,locationCountry:USA,locationState:FL,locationCity:Brevard County,id:1];.....

    If you fetch the location data via queryEntiity() and store the selected value in a CDT, then it might be that the data types do not match. queryEntity returns untyped dictionaries while inside the CDT it is of the specified type. If this is the case, you can put the result of queryEntity into a type cast to "type!YOUR_TYPE?list".

    Does that help?

  • I dont understand what you mean by local!selected or what type!YOUR_TYPE?list means do you have an example?

  • local!selected is a local variable to store the value selected in the drop down

    In the type! domain you have access to all your CDTs. Adding a "?list" to the name allows you to cast a list of untyped dictionaries to your data type. Please check documentation for the function "cast()" and "a!localVariables".

    BTW, it helps a lot when you provide code and error messages. Try to reduce your code like I did in my example. Then you get a chance to find out how the drop down works.

  • So this works but I cant save it into my database which is what I am trying to do how would I save it into the database?

Reply Children