How to configure show when

So, I need to use visibility/showWhen to display a dropdown if a certain choice of radio button is selected.

The format is kind of like this, the two dropdowns are supposed to be hidden until 'Yes' is selected in the group of the second radio buttons.

This is currently the code I have. I'm still fairly new to Appian and trying to figure things out!

I have experience w/Python/C#/Vis Basic so explaining in those terms could be helpful as well

if(
  a!radioButtonField(choiceLabels: "Yes"),
 	showWhen:true()

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    You can put any expression into that parameter that evaluates to a boolean. Typically we use a comparison operator like <, >, =.

  • So I typed it out correctly, but I just need to use a different operator?

  • 0
    Certified Lead Developer
    in reply to davinar9817

    please post your current full code snippet - that error indicates a syntactical issue has crept in, most likely.

  • a!formLayout(
      label: "Contractor Form",
      contents: {
        a!sectionLayout(
          contents: {
            a!columnsLayout(
              columns: {
                a!columnLayout(
                  contents: {
                    a!textField(
                      label: "First Name",
                      labelPosition: "ABOVE",
                      value: ri!record['recordType!{d327a5dc-18d4-4ffd-8bdf-6a22b134677f}DS Contractor.fields.{6576c50e-e121-46f9-ac66-80f275bdd60b}firstName'],
                      saveInto: ri!record['recordType!{d327a5dc-18d4-4ffd-8bdf-6a22b134677f}DS Contractor.fields.{6576c50e-e121-46f9-ac66-80f275bdd60b}firstName'],
                      refreshAfter: "UNFOCUS",
                      required: true,
                      validations: {}
                    )
                  }
                ),
                a!columnLayout(
                  contents: {
                    a!textField(
                      label: "Last Name",
                      labelPosition: "ABOVE",
                      value: ri!record['recordType!{d327a5dc-18d4-4ffd-8bdf-6a22b134677f}DS Contractor.fields.{9ad498eb-f112-4373-9f83-98d98fe98f1d}lastName'],
                      saveInto: ri!record['recordType!{d327a5dc-18d4-4ffd-8bdf-6a22b134677f}DS Contractor.fields.{9ad498eb-f112-4373-9f83-98d98fe98f1d}lastName'],
                      refreshAfter: "UNFOCUS",
                      required: true,
                      validations: {}
                    )
                  }
                )
              }
            )
          }
        ),
        a!sectionLayout(
          label: "",
          contents: {
            a!columnsLayout(
              columns: {
                a!columnLayout(
                  contents: {
                    a!columnsLayout(
                      columns: {
                        a!columnLayout(
                          contents: {
                            a!integerField(
                              label: "Contractor's Phone Number ",
                              labelPosition: "ABOVE",
                              instructions: "Please submit a number that is easily accessible.",
                              value: ri!record['recordType!{d327a5dc-18d4-4ffd-8bdf-6a22b134677f}DS Contractor.fields.{f2502f28-185b-4cdb-87eb-56e09d28d249}conphoneNum'],
                              saveInto: ri!record['recordType!{d327a5dc-18d4-4ffd-8bdf-6a22b134677f}DS Contractor.fields.{f2502f28-185b-4cdb-87eb-56e09d28d249}conphoneNum'],
                              refreshAfter: "UNFOCUS",
                              required: true,
                              validations: {}
                            )
                          }
                        ),
                        a!columnLayout(
                          contents: {
                            a!textField(
                              label: "Contractor's Company Name",
                              labelPosition: "ABOVE",
                              value: ri!record['recordType!{d327a5dc-18d4-4ffd-8bdf-6a22b134677f}DS Contractor.fields.{2476f354-8a05-4418-a463-61d9127ee99d}conCompanyName'],
                              saveInto: ri!record['recordType!{d327a5dc-18d4-4ffd-8bdf-6a22b134677f}DS Contractor.fields.{2476f354-8a05-4418-a463-61d9127ee99d}conCompanyName'],
                              refreshAfter: "UNFOCUS",
                              required: true,
                              validations: {}
                            )
                          }
                        ),
                        a!columnLayout(
                          contents: {
                            a!textField(
                              label: "Contractor's Email",
                              labelPosition: "ABOVE",
                              instructions: "Their company email address.",
                              value: ri!record['recordType!{d327a5dc-18d4-4ffd-8bdf-6a22b134677f}DS Contractor.fields.{2952c2ae-aeb6-47f0-9655-0628f009e981}contractorEmail'],
                              saveInto: ri!record['recordType!{d327a5dc-18d4-4ffd-8bdf-6a22b134677f}DS Contractor.fields.{2952c2ae-aeb6-47f0-9655-0628f009e981}contractorEmail'],
                              refreshAfter: "UNFOCUS",
                              validations: {}
                            )
                          }
                        )
                      }
                    )
                  }
                )
              }
            )
          }
        ),
        a!columnsLayout(
          columns: {
            a!columnLayout(
              contents: {
                a!textField(
                  label: "Project Name",
                  labelPosition: "ABOVE",
                  value: ri!record['recordType!{d327a5dc-18d4-4ffd-8bdf-6a22b134677f}DS Contractor.fields.{797f8093-85fb-4e18-b4b9-e5e85a7ccbe7}projName'],
                  saveInto: ri!record['recordType!{d327a5dc-18d4-4ffd-8bdf-6a22b134677f}DS Contractor.fields.{797f8093-85fb-4e18-b4b9-e5e85a7ccbe7}projName'],
                  refreshAfter: "UNFOCUS",
                  required: true,
                  validations: {}
                )
              },
              width: "NARROW"
            ),
            a!columnLayout(
              contents: {
                a!dateField(
                  label: "Start Date",
                  labelPosition: "ABOVE",
                  saveInto: {},
                  required: true,
                  validations: {}
                )
              },
              width: "NARROW"
            ),
            a!columnLayout(
              contents: {
                a!dateField(
                  label: "End Date",
                  labelPosition: "ABOVE",
                  saveInto: {},
                  required: true,
                  validations: {}
                )
              },
              width: "NARROW"
            )
          },
          spacing: "SPARSE"
        ),
        a!columnsLayout(
          columns: {
            a!columnLayout(
              contents: {
                a!textField(
                  label: "Axiom Manager's Name",
                  labelPosition: "ABOVE",
                  value: ri!record['recordType!{d327a5dc-18d4-4ffd-8bdf-6a22b134677f}DS Contractor.fields.{acd634c0-572b-45e4-9327-9a76ffa8ed82}mngrName'],
                  saveInto: ri!record['recordType!{d327a5dc-18d4-4ffd-8bdf-6a22b134677f}DS Contractor.fields.{acd634c0-572b-45e4-9327-9a76ffa8ed82}mngrName'],
                  refreshAfter: "UNFOCUS",
                  required: true,
                  validations: {}
                )
              }
            ),
            a!columnLayout(
              contents: {
                a!textField(
                  label: "Axiom Manager's Email",
                  labelPosition: "ABOVE",
                  value: ri!record['recordType!{d327a5dc-18d4-4ffd-8bdf-6a22b134677f}DS Contractor.fields.{3e72a18f-c6b9-4223-a4e9-37631f23a060}mngrEmail'],
                  saveInto: ri!record['recordType!{d327a5dc-18d4-4ffd-8bdf-6a22b134677f}DS Contractor.fields.{3e72a18f-c6b9-4223-a4e9-37631f23a060}mngrEmail'],
                  refreshAfter: "UNFOCUS",
                  required: true,
                  validations: {}
                )
              }
            ),
            a!columnLayout(
              contents: {}
            )
          }
        ),
        a!columnsLayout(
          columns: {
            a!columnLayout(
              contents: {
                a!radioButtonField(
                  label: "Is Jama Access Required?",
                  labelPosition: "ABOVE",
                  choiceLabels: {"Yes", "No"},
                  choiceValues: {1, 2},
                  value: ri!radioValues,
                  saveInto: ri!radioValues,
                  required: true,
                  choiceLayout: "COMPACT",
                  validations: {}
                ),
                a!radioButtonField(
                  label: "Is Jira Access Required?",
                  labelPosition: "ABOVE",
                  choiceLabels: {"Yes", "No"},
                  choiceValues: {1, 2},
                  value: ri!radioValues2,
                  saveInto: ri!radioValues2,
                  required: true,
                  choiceLayout: "COMPACT",
                  validations: {}
    
                ),
                a!radioButtonField(
                  label: "Is Confluence Access Required?",
                  labelPosition: "ABOVE",
                  choiceLabels: {"Yes", "No"},
                  choiceValues: {1, 2},
                  value: ri!radioValues,
                  saveInto: ri!radioValues,
                  required: true,
                  choiceLayout: "COMPACT",
                  validations: {}
    
                )
              },
              width: "NARROW"
            ),
            a!columnLayout(
              contents: {
                a!dropdownField(
                  label: "Which Department Requires Access?",
                  labelPosition: "ABOVE",
                  placeholder: "--- Select a Value ---",
                  choiceLabels: {                                                /*check AT_employeeForm when needed*/
                    "Engineering",
                    "Legal",
                    "Accounting",
                    "Corporate Ops",
                    "Flight Ops",
                    "In-Space R&M",
                    "Safety",
                    "IT",
                    "Medical"
                  },
    
                  choiceValues: {                                          /*check AT_employeeForm when needed*/
                    1,
                    2,
                    3,
                    4,
                    5,
                    6,
                    7,
                    8,
                    9
                  },
                  searchDisplay: "AUTO",
                  showWhen: if(
                  ri!radioValues2 = true(),
                  showWhen:true()
    ),
                  
                
                  required: true,
                  validations: {}
                ),
                  
                  
                  
                  
                a!dropdownField(
                  label: "Which Engineering Department Requires Access?",
                  labelPosition: "ABOVE",
                  placeholder: "--- Select a Value ---",
                  choiceLabels: {"AIT",
    
                  "ASCB",
    
                  "Avionics",
    
                  "AxPAC",
    
                  "AxPLSS",
    
                  "CAD",
    
                  "Crew Systems",
    
                  "EAM",
    
                  "ECLSS"},
                  choiceValues: {1, 2, 3, 4, 5, 6, 7, 8, 9},
                  saveInto: {},
                  searchDisplay: "AUTO",
                  required: true,
                  validations: {}
                )
              }
            ),
            a!columnLayout(
              contents: {}
            )
          },
          spacing: "SPARSE"
        )
      },
      buttons: a!buttonLayout(
        primaryButtons: {
          a!buttonWidget(
            label: "Submit",
            submit: true,
            style: "PRIMARY"
          )
        },
        secondaryButtons: {
          a!buttonWidget(
            label: "Cancel",
            value: true,
            saveInto: ri!cancel,
            submit: true,
            style: "NORMAL",
            validate: false
          )
        }
      )
    )

  • I keep trying to post it but it keeps getting flagged as spam for some reason

  • +1
    Certified Lead Developer
    in reply to davinar9817

    Line 242 should be:

                  searchDisplay: "AUTO",
                  showWhen: ri!radioValues2,
                  required: true,
    

  • +1
    Certified Lead Developer
    in reply to Stefan Helzle

    FWIW, i actually answered this correctly before, and it should be "ri!radioValues2 = 1" as i said in my earlier reply (though the RI name has apparently changed in the meantime).  " = true()" would also work though only since that evaluates to 1, but the data being compared is integer value and not boolean.

    Thus the full corrected code for that particular dropdown field would look like:

    a!dropdownField(
      label: "Which Department Requires Access?",
      labelPosition: "ABOVE",
      placeholder: "--- Select a Value ---",
      choiceLabels: {
        "Engineering",
        "Legal",
        "Accounting",
        "Corporate Ops",
        "Flight Ops",
        "In-Space R&M",
        "Safety",
        "IT",
        "Medical"
      },
      choiceValues: { 1, 2, 3, 4, 5, 6, 7, 8, 9 },
      searchDisplay: "AUTO",
      showWhen: ri!radioValues2 = 1,
      required: true,
      validations: {}
    )

  • Hey I reached out to the Community admins to approve. We're always working on fine-tuning the flagging filters

  • 0
    Certified Lead Developer
    in reply to April Schuppel

    Cool thanks - it was approved by the next time I looked, anyway Slight smile

  • 0
    Certified Senior Developer
    in reply to davinar9817

    you are missing value and saveinto parameter in dropdown value 

    Create a rule input and map it to value and saveinto parameter

    also you have used wrong code in show when 

    showWhen: if(
    ri!radioValues2 = true(),
    showWhen:true()
    ),

    {a!dropdownField(
    label: "Which Department Requires Access?",
    labelPosition: "ABOVE",
    placeholder: "--- Select a Value ---",
    choiceLabels: { /*check AT_employeeForm when needed*/
    "Engineering",
    "Legal",
    "Accounting",
    "Corporate Ops",
    "Flight Ops",
    "In-Space R&M",
    "Safety",
    "IT",
    "Medical"
    },

    choiceValues: { /*check AT_employeeForm when needed*/
    1,
    2,
    3,
    4,
    5,
    6,
    7,
    8,
    9
    },
    searchDisplay: "AUTO",
    value: ri!dropDown1,
    saveInto: ri!dropDown1,
    showWhen: if(
    ri!radioValues2 = true(),
    true(),
    false()
    ),


    required: true,
    validations: {}
    ),


    a!dropdownField(
    label: "Which Engineering Department Requires Access?",
    labelPosition: "ABOVE",
    placeholder: "--- Select a Value ---",
    choiceLabels: {"AIT",

    "ASCB",

    "Avionics",

    "AxPAC",

    "AxPLSS",

    "CAD",

    "Crew Systems",

    "EAM",

    "ECLSS"},
    choiceValues: {1, 2, 3, 4, 5, 6, 7, 8, 9},
    value: ri!dropDown2,
    saveInto: ri!dropDown2,

    searchDisplay: "AUTO",
    required: true,
    validations: {}
    )}

  • 0
    Certified Lead Developer
    in reply to Komal Jain
    1. your answer really just repeats things already said (a few different times previously) by Stefan and myself
    2. when you put a long snippet of code into a comment, it's imperative that you (please!) use a Code Box, because otherwise the result (as seen here) is nearly unreadable and severely lowers a thread's readability due to wasted scrolling space.
Reply Children
No Data