more drop-down help

Certified Associate Developer

Sorry for the massive amount of questions, 

but I do not understand this error message:

Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function a!dropdownField [line 978]: A dropdown component [label=“Symbol Modifier 1”] has an invalid value for “value”. All selected values must be present in the choiceValues array, but value was 00 and choiceValues was 00.

here is my full drop down:

a!dropdownField(
                      label: "Symbol Modifier 1",
                      labelPosition: "JUSTIFIED",
                      placeholder: "--- Select a Value ---",
                     
                      choiceLabels: {
                      choose(
                        wherecontains(local!mod1, local!modList),
                        
                        "1",
                        local!airmod1.firstmodifier,
                        local!airmmod1.firstmodifier,
                        local!spacemod1.firstmodifier,
                        local!spacemmod1.firstmodifier,
                        
                        local!landUnitmod1.firstmodifier,
                        local!civLandmod1.firstmodifier,
                        local!landEquipmod1.firstmodifier,
                        local!landInstall.firstmodifier,
                        ("not here"),
                        local!SeaSurface.firstmodifier,
                        local!SeaSubSurface.firstmodifier,
                        local!activities.firstmodifier,
                        local!signals.firstmodifier,
                        
                      ) 
                      },
                      choiceValues: choose(
                        wherecontains(local!mod1, local!modList),
                        tostring("00"),
                        local!airmod1.code,
                        local!airmmod1.code,
                        local!spacemod1.code,
                        local!spacemmod1.code,
                        
                        local!landUnitmod1.code,
                        local!civLandmod1.code,
                        local!landEquipmod1.code,
                        local!landInstall.code,
                        
                        tostring("00"),
                        local!SeaSurface.code,
                        local!SeaSubSurface.code,
                        local!activities.code,
                        local!signals.code,
                      ), 
                      value: tostring("00"),
                      /*if(*/
                        /*rule!APN_isEmpty(ri!Symbol.symbMod1),*/
                        /*"00",*/
                        /*ri!Symbol.symbMod1*/
                      /*),*/
                      saveInto: {ri!Symbol.symbMod1,a!save(local!symbMod1,ri!Symbol.symbMod1)},
                      searchDisplay: "AUTO",
                      showWhen: not(rule!APN_isEmpty(local!mod1)),
                      validations: {}
                    )

I am trying to get a string representation of 00

I have tried using "00" and tostring("00")

I think it has to be how the choose or the where contains functions work because I have hard coded the same value in and it is still giving me the same error message. 

I have tried changing the value and the error message changes so that is not it. 

thanks in advance for your assistance,

Kevin 

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    What are you attempting to do with this chunk of code found both within your choiceLabels and choiceValues?

    choose(
      wherecontains(local!mod1, local!modList),
      ...

    As far as I know, choose() takes a single choice and returns a single selection.  So essentially you'd always have a dropdown with one choice, which I don't understand the point of.

    Secondary suggestion(s):

    • Instead of throwing everything you can think of straight into a dropdown (especially since dropdowns are finicky about data types and nulls), do some debugging: add a paragraph field above it labelled "DEBUG" (for easy locating later) and set its value to the expression you want to test - in your case I'd start with your "choiceValues" array.  Make sure it actually evaluates to the array you're expecting.
    • Instead of assembling your dropdown values and labels directly in the dropdown definition, you could assemble them into their own local variables - this is especially beneficial if you're using a!localVariables() (which everyone should be at this point unless they're stuck in an outdated version of Appian), because then you'd be able to see the evaluated values of each in your sidebar.
      • You could probably even do something more efficient/graceful with your choices assembly - i.e. use a!forEach() to iterate over an array of your units ({local!airmod1, local!airmmod1, ..... }), and within each loop, set a dictionary containing {value: X, label: Y}; then for your dropdown definition you could just point choiceValues to local!dropdownChoices.value, etc.
  • 0
    Certified Associate Developer
    in reply to Mike Schmitt

    thanks you  for the reply Grinning,

    I am trying to select just one of the many query's based off of another previous selection.

    if you know of another way to accomplish this please share. (maybe what you said with your third point?)

    I have 11 queries with 23 choices some choices are the same and some are just the default or "00"

    is it not possible to represent "00" in Appian? with the choose and where contains? 

    I can code in another value if that is the case,

    as to to your second point. 

    I have tried to do a debug paragraph and everything is showing as expected.

    the value is 00 text and the value of the I am trying to get it to show is 00 text I do not know how to accomplish this in Appian.

      

    • You could probably even do something more efficient/graceful with your choices assembly - i.e. use a!forEach() to iterate over an array of your units ({local!airmod1, local!airmmod1, ..... }), and within each loop, set a dictionary containing {value: X, label: Y}; then for your dropdown definition you could just point choiceValues to local!dropdownChoices.value, etc.

    where could I put the code I would be making this dictionary? 

    I have put it where I thought it had to go. 

    again thank you so much for helping me learn Appian Smiley

  • +1
    Certified Lead Developer
    in reply to kevinr0001

    I might be somewhat misunderstanding your use case.  What is the complete value, specifically, of "local!airmod1.firstmodifier", for example?

    Regarding "00" - that's a valid string and you don't need to wrap it in "toString()", however I'm not understanding what you're trying to accomplish by injecting it into the middle of your choiceValues choose() list.  If the choose() evaluates in such a way that "00" is the choicevalue, I would expect the dropdown to not necessarily cooperate since it expects an array to be provided for both choiceValues and choiceLabels.

    For the dictionary I mentioned - you would put this as another local variable definition within a!localVariables and after all the ones you have already (or at least after any it refers to).

  • 0
    Certified Associate Developer
    in reply to Mike Schmitt

    thank you you for the response

    this is "local!airmod1.firstmodifier"

    Not Applicable ; Attack/Strike ; Bomber ; Cargo ; Fighter ; Interceptor ; Tanker ; Utility ; Vertical or Short Take-off and Landing (VSTOL)/ Vertical Take-off and Landing (VTOL) ; Passenger ; Ultra Light ; Airborne Command Post (ACP) ; Airborne Early Warning (AEW) ; Government ; Medical Evacuation (MEDEVAC) ; Escort ; Electronic Combat (EC)/Jammer ; Patrol ; Reconnaissance ; Trainer ; Photographic (Reconnaissance) ; Personnel Recovery ; Antisubmarine Warfare ; Communications ; Electronic Support (ES) ; Mine Countermeasures (MCM) ; Search and Rescue ; Special Operations Forces ; Surface Warfare ; Very Important Person (VIP) Transport ; Combat Search and Rescue (CSAR) ; Suppression of Enemy Air Defenses ; Antisurface Warfare ; Fighter/Bomber ; Intensive Care ; Electronic Attack (EA) ; Multimission ; Hijacking ; ASW Helo- LAMPS ; ASW Helo ? SH-60R 

    I am trying to let certain values be the "default" value in my values list since I do not have a drop-down value for all of them 

    here is the value of my "modList":

    local!modList:{ /*list of all local mod options */
        "00",/*Unknown   */
        "01",    /*"Air",*/
        "02",/* "Air Missile",*/
        "05",/*      "Space",*/
        "06",/*"Space Missile",*/ 
        "10",/*"land unit",*/
        "11",/*  Land Civilian Unit/Organization */
        "15",/*  Land Equipment */
        "20",/* Land Installation  */
        "25",/* Control Measure */
        "30",/* Sea Surface   */
        "35",/*  Sea Subsurface */
        "36",/*  Mine Warfare */
        "40",/* Activities  */
        "45",/* Atmospheric  */
        "46",/*  Oceanographic */
        "47",/* Meteorological Space  */
        "50",/* Signals Intelligence – Space  */
        "51",/* Signals Intelligence – Air  */
        "52",/* Signals Intelligence – Land  */
        "53",/* Signals Intelligence – Surface  */
        "54",/* Signals Intelligence – Subsurface  */
        "60" /* Cyberspace  */
      },

    here is my mod list with query's:

    choose(
                            wherecontains(local!mod1, local!modList),
                            tostring("00"),/*Unknown   */
                            local!airmod1.code, /*"Air",*/
                            local!airmmod1.code,/* "Air Missile",*/
                            local!spacemod1.code,/*      "Space",*/
                            local!spacemmod1.code,/*"Space Missile",*/ 
                            local!landUnitmod1.code,/*"land unit",*/
                            local!civLandmod1.code,/*  Land Civilian Unit/Organization */
                            local!landEquipmod1.code,/*  Land Equipment */
                            local!landInstall.code,/* Land Installation  */
                            tostring("00"),/* Control Measure */
                            local!SeaSurface.code,/* Sea Surface   */
                            local!SeaSubSurface.code,/* Sea sub Surface   */
                            /*  Mine Warfare */
                            local!activities.code,/* Activities  */
                            /* "45", Atmospheric  */
                            /* "46", Oceanographic */
                            /*  "47",/* Meteorological Space  */
                            local!signals.code,/*"50", Signals Intelligence – Space  */
                            local!signals.code/*"51",/* Signals Intelligence – Air  */
                            local!signals.code/*"52",/* Signals Intelligence – Land  */
                            local!signals.code/*"53",/* Signals Intelligence – Surface  */
                            local!signals.code/*"54",/* Signals Intelligence – Subsurface  */
                            /*"60" /* Cyberspace  */
                          )

    you are right about it not doing anything. I was just trying to code it so it does not "error out" or break it. I was going to disable the drop-down or hide it for the places that I do not need it 

  • 0
    Certified Associate Developer
    in reply to Mike Schmitt

    thank you, that fixed it. 

    to clarify for anyone that is reading this later I added an array of values so {"00","01"} and it worked 

    thanks Mike!

Reply Children
No Data