Interface

Certified Associate Developer

In the interface. I am getting error message for the below piece of code. 

Error message :

Expression evaluation error in rule 'sshs_startformquestions' at function a!cardLayout [line 48]: Cannot compare incompatible operands of type Null and type Number (Integer).

Line: showWhen: {
local!selected1 = 2
}

It would be great if someone can help. 

  Discussion posts and replies are publicly visible

Parents Reply Children
  • 0
    Certified Senior Developer
    in reply to hema.mathivathanan

    Hello ,

    Can you please share your code? It would be more clear in order to provide an answer.

  • 0
    Certified Associate Developer
    in reply to Konduru Chaitanya

    a!localVariables(
      local!selected1,
      local!selected2,
      local!selected3,
      {
        a!richTextDisplayField(
          value: {
            a!richTextItem(
              text: "Please answer the below question(s)",
              style: "PLAIN"
            )
          }
        ),
        a!radioButtonField(
          label: "1.",
          labelPosition: "ABOVE",
          choiceLabels: { "Yes", "No" },
          choiceValues: { 1, 2 },
          value: local!selected1,
          saveInto: local!selected1,
          choiceLayout: "COMPACT",
          choiceStyle: "STANDARD",
          required: true,
        ),
        a!cardLayout(
          contents: {
            a!richTextDisplayField(
              value: {
                a!richTextItem(
                  text: {
    ""
                  },
                  link: a!safeLink(
                    label: "Appian Hardware Sizing methods",
                    openLinkIn: "SAME_TAB"
                  ),
                  linkstyle: "STANDALONE"
                )
              }
            ),
            
          },
          style: "INFO",
          showBorder: false,
          showWhen:if(
            a!isNullOrEmpty(
              local!selected1),null,local!selected1 = 2
            )
          
          /*showWhen: local!selected1=2,*/
          ),
          
             a!radioButtonField(
          label: "2",
          labelPosition: "ABOVE",
          choiceLabels: { "Yes", "No" },
          choiceValues: { 1, 2 },
          value: local!selected2,
          saveInto: local!selected2,
          choiceLayout: "COMPACT",
          choiceStyle: "STANDARD",
          required: true,
          showWhen:if(
            a!isNullOrEmpty(
              local!selected1),null,local!selected1 = 1
          )
          
          /*showWhen: local!selected1 =1*/
        ),
        a!cardLayout(
          contents: {
            a!richTextDisplayField(
              value: {
                a!richTextItem(
                  text: {
                    "document",
                    
                  },
                  link: a!documentDownloadLink(document: 2354149, ),
                  linkstyle: "STANDALONE"
                )
              }
            ),
            
          },
          style: "INFO",
          showBorder: false,
          /*showWhen: if(*/
           /*a!isNullOrEmpty(local!selected1),null, */
    /**/
           /*local!selected1=1*/
    /*)*/
          
          showWhen: and(
            local!selected1 =1, 
            local!selected2=2
          )
        ),
        a!radioButtonField(
          label: "3.",
          labelPosition: "ABOVE",
          choiceLabels: { "Yes", "No" },
          choiceValues: { 1, 2 },
          value: local!selected3,
          saveInto: local!selected3,
          choiceLayout: "COMPACT",
          choiceStyle: "STANDARD",
          required: true,
          showWhen: {
            and(local!selected2 = 1, local!selected1 = 1)
          }
          
         
        ),
        /*a!cardLayout(*/
          /*contents: {*/
            /*a!richTextDisplayField(*/
              /*value: {*/
                /*a!richTextItem(*/
                  /*text: {*/
                    /*"document",*/
    /*                */
                  /*},*/
                  /*link: a!documentDownloadLink(document: 2354149, ),*/
                  /*linkstyle: "STANDALONE"*/
                /*)*/
              /*}*/
            /*),*/
    /*        */
          /*},*/
          /*style: "INFO",*/
          /*showBorder: false,*/
          /*showWhen: {*/
            /*and(*/
              /*local!selected1 = 1,*/
              /*local!selected2 = 1,*/
              /*local!selected3 = 1*/
            /*)*/
          /*}*/
        /*),*/
        /*a!cardLayout(*/
          /*contents: {*/
            /*a!richTextDisplayField(*/
              /*value: {*/
                /*a!richTextItem(*/
                  /*text: {*/
                    /*" ocument",*/
    /*                */
                  /*},*/
                  /*link: a!documentDownloadLink(document: 2354149, ),*/
                  /*linkstyle: "STANDALONE"*/
                /*)*/
              /*}*/
            /*),*/
    /*        */
          /*},*/
          /*style: "INFO",*/
          /*showBorder: false,*/
          /*showWhen: {*/
            /*and(*/
              /*local!selected1 = 1,*/
              /*local!selected2 = 1,*/
              /*local!selected3 = 2*/
            /*)*/
          /*}*/
        /*),*/
    /*    */
      },
      
    )

  • 0
    Certified Associate Developer
    in reply to Konduru Chaitanya

    a!localVariables(
      local!selected1,
      local!selected2,
      local!selected3,
      {
        a!richTextDisplayField(
          value: {
            a!richTextItem(
              text: "",
              style: "PLAIN"
            )
          }
        ),
        a!radioButtonField(
          label: "1",
          labelPosition: "ABOVE",
          choiceLabels: { "Yes", "No" },
          choiceValues: { 1, 2 },
          value: local!selected1,
          saveInto: local!selected1,
          choiceLayout: "COMPACT",
          choiceStyle: "STANDARD",
          required: true,
        ),
        a!cardLayout(
          contents: {
            a!richTextDisplayField(
              value: {
                a!richTextItem(
                  text: {
                    "document",
                    
                  },
                  link: a!safeLink(
                    label: " methods",
                    openLinkIn: "SAME_TAB"
                  ),
                  linkstyle: "STANDALONE"
                )
              }
            ),
            
          },
          style: "INFO",
          showBorder: false,
          showWhen:if(
            a!isNullOrEmpty(
              local!selected1),null,local!selected1 = 2
            )
          
          /*showWhen: local!selected1=2,*/
          ),
          
             a!radioButtonField(
          label: "2.",
          labelPosition: "ABOVE",
          choiceLabels: { "Yes", "No" },
          choiceValues: { 1, 2 },
          value: local!selected2,
          saveInto: local!selected2,
          choiceLayout: "COMPACT",
          choiceStyle: "STANDARD",
          required: true,
          showWhen:if(
            a!isNullOrEmpty(
              local!selected1),null,local!selected1 = 1
          )
          
          /*showWhen: local!selected1 =1*/
        ),
        a!cardLayout(
          contents: {
            a!richTextDisplayField(
              value: {
                a!richTextItem(
                  text: {
                    " document",
                    
                  },
                  linkstyle: "STANDALONE"
                )
              }
            ),
            
          },
          style: "INFO",
          showBorder: false,
          /*showWhen: if(*/
           /*a!isNullOrEmpty(local!selected1),null, */
    /**/
           /*local!selected1=1*/
    /*)*/
          
          showWhen: and(
            local!selected1 =1, 
            local!selected2=2
          )
          
    
          
          
    
          
        ),
        a!radioButtonField(
          label: "3.",
          labelPosition: "ABOVE",
          choiceLabels: { "Yes", "No" },
          choiceValues: { 1, 2 },
          value: local!selected3,
          saveInto: local!selected3,
          choiceLayout: "COMPACT",
          choiceStyle: "STANDARD",
          required: true,
          showWhen: {
            and(local!selected2 = 1, local!selected1 = 1)
          }
          
         
        ),
       
        /*a!cardLayout(*/
          /*contents: {*/
            /*a!richTextDisplayField(*/
              /*value: {*/
                /*a!richTextItem(*/
                  /*text: {*/
                    /*" document",*/
    /*                */
                  /*},*/
                  /*linkstyle: "STANDALONE"*/
                /*)*/
              /*}*/
            /*),*/
    /*        */
          /*},*/
          /*style: "INFO",*/
          /*showBorder: false,*/
          /*showWhen: {*/
            /*and(*/
              /*local!selected1 = 1,*/
              /*local!selected2 = 1,*/
              /*local!selected3 = 2*/
            /*)*/
          /*}*/
        /*),*/
    /*    */
      },
      
    )
    This is the code.

  • +1
    Certified Senior Developer
    in reply to hema.mathivathanan

    a!localVariables(
      local!selected1,
      local!selected2,
      local!selected3,
      {
        a!richTextDisplayField(
          value: { a!richTextItem(text: "", style: "PLAIN") }
        ),
        a!radioButtonField(
          label: "1",
          labelPosition: "ABOVE",
          choiceLabels: { "Yes", "No" },
          choiceValues: { 1, 2 },
          value: local!selected1,
          saveInto: local!selected1,
          choiceLayout: "COMPACT",
          choiceStyle: "STANDARD",
          required: true,
          
        ),
        a!cardLayout(
          contents: {
            a!richTextDisplayField(
              value: {
                a!richTextItem(
                  text: { "document",  },
                  link: a!safeLink(label: " methods", openLinkIn: "SAME_TAB"),
                  linkstyle: "STANDALONE"
                )
              }
            ),
            
          },
          style: "INFO",
          showBorder: false,
          showWhen: if(
            a!isNullOrEmpty(local!selected1),
            {},
            local!selected1 = 2
          )/*showWhen: local!selected1=2,*/
          
        ),
        a!radioButtonField(
          label: "2.",
          labelPosition: "ABOVE",
          choiceLabels: { "Yes", "No" },
          choiceValues: { 1, 2 },
          value: local!selected2,
          saveInto: local!selected2,
          choiceLayout: "COMPACT",
          choiceStyle: "STANDARD",
          required: true,
          showWhen: if(
            a!isNullOrEmpty(local!selected1),
            null,
            local!selected1 = 1
          )/*showWhen: local!selected1 =1*/
          
        ),
        a!cardLayout(
          contents: {
            a!richTextDisplayField(
              value: {
                a!richTextItem(
                  text: { " document",  },
                  linkstyle: "STANDALONE"
                )
              }
            ),
            
          },
          style: "INFO",
          showBorder: false,
          /*showWhen: if(*/
          /*a!isNullOrEmpty(local!selected1),null, */
          /**/
          /*local!selected1=1*/
          /*)*/
          showWhen: if(
            and(
              a!isNotNullOrEmpty(local!selected1),
              a!isNotNullOrEmpty(local!selected2)
            ),
            and(local!selected1 = 1, local!selected2 = 2),
            {}
          )
        ),
        a!radioButtonField(
          label: "3.",
          labelPosition: "ABOVE",
          choiceLabels: { "Yes", "No" },
          choiceValues: { 1, 2 },
          value: local!selected3,
          saveInto: local!selected3,
          choiceLayout: "COMPACT",
          choiceStyle: "STANDARD",
          required: true,
          showWhen: {
            if(
              and(
                a!isNullOrEmpty(local!selected1),
                a!isNullOrEmpty(local!selected2)
              ),
              {},
              and(
                tointeger(local!selected2) = 1,
                tointeger(local!selected1) = 1
              )
            )
          }
        ),
        /*a!cardLayout(*/
        /*contents: {*/
        /*a!richTextDisplayField(*/
        /*value: {*/
        /*a!richTextItem(*/
        /*text: {*/
        /*" document",*/
        /*                */
        /*},*/
        /*linkstyle: "STANDALONE"*/
        /*)*/
        /*}*/
        /*),*/
        /*        */
        /*},*/
        /*style: "INFO",*/
        /*showBorder: false,*/
        /*showWhen: {*/
        /*and(*/
        /*local!selected1 = 1,*/
        /*local!selected2 = 1,*/
        /*local!selected3 = 2*/
        /*)*/
        /*}*/
        /*),*/
        /*    */
        
      },
      
    )

    Just few changes in the show When. You can also create an expression rule and call it multiple places avoiding typing of same code lines with different values.

    When there is no value in your Local variable it will not be able to determine the type. hence the error.