Skip to main content
May 22, 2023
Solved

interface within interface

  • May 22, 2023
  • 7 replies
  • 1 view






and when I click on cancel for this 2nd interface , I need to get 1st interface again with  3 buttons hiding the comment form(above form)


Can someone help me with the code please

    Best answer by shoaiba0003

    Try using this code, I believe this will suites your use case with showWhen property, 

    PS: you can use if else for the same scenario, just stack the sectionLayouts (Interface1, Interface2) and check or any one condition for pressed button.

    a!localVariables(
      /*pressed button variable, default value have to be there for showing 1st interface*/
      local!pressedButton: "cancel",
      a!sectionLayout(
        contents: {
          /*Interface 1*/
          a!sectionLayout(
            contents: {
              a!boxLayout(
                label: "Some form",
                contents: {
                  a!textField(label: "Comments", readOnly: true),
                  a!textField(label: "Start Date", readOnly: true),
                  a!textField(label: "End Date", readOnly: true),
                  a!textField(label: "Emial", readOnly: true),
                  
                }
              ),
              a!buttonLayout(
                primaryButtons: {
                  a!buttonWidget(label: "approve"),
                  a!buttonWidget(
                    label: "reject",
                    value: "reject",
                    saveInto: local!pressedButton
                  )
                },
                secondaryButtons: { a!buttonWidget(label: "cancel") }
              )
            },
            showWhen: local!pressedButton = "cancel"
          ),
          /*Interface 2*/
          a!sectionLayout(
            contents: {
              a!boxLayout(
                label: "Some form",
                contents: {
                  a!paragraphField(label: "Comments", readOnly: true)
                }
              ),
              a!buttonLayout(
                primaryButtons: {
                  a!buttonWidget(
                    label: "cancel",
                    value: "cancel",
                    saveInto: local!pressedButton
                  ),
                  a!buttonWidget(label: "submit")
                }
              )
            },
            showWhen: local!pressedButton = "reject"
          )
        }
      )
    )
      

    7 replies

    May 22, 2023

    There are numerous ways to configure in accordance with these requirements within a single interface.
    Have you followed any basic trainings yet in the Appian Academy?

    sabat0002Author
    May 22, 2023

    yes , i have few basic knowledge , I tired doing it using showwhen but getting errors .can you please help 

    mikes0011
    Brainy
    May 22, 2023

    If you're getting errors, it'd be helpful to post screenshots of the actual errors too, and describe what user action(s) lead to the error(s) in question, etc.  Additionally it might be helpful for you to share your code (or at least relevant snippets) - and if you do, please be sure to use a Code Box.

    The Expression Guru
    davel001150
    May 22, 2023

    Perhaps the simplest way is to create the "popup" as you call it as a separate component within it's own Interface object, then call it from the larger interface with a showWhen variable passed to it, or inside an if() function like if(local!commenting, rule!APP_commentInterface([parameters]), {}).

    You'll probably need to explain the errors that are happening when you try showWhen for us to help you further from there.

    mallepup3914
    May 22, 2023

    You can achieve this using local variables by saving a value in local variable when user click on buttons and based on saved value in local variable you can apply it in showwhen in interfaces.

    May 22, 2023

    Try using this code, I believe this will suites your use case with showWhen property, 

    PS: you can use if else for the same scenario, just stack the sectionLayouts (Interface1, Interface2) and check or any one condition for pressed button.

    a!localVariables(
      /*pressed button variable, default value have to be there for showing 1st interface*/
      local!pressedButton: "cancel",
      a!sectionLayout(
        contents: {
          /*Interface 1*/
          a!sectionLayout(
            contents: {
              a!boxLayout(
                label: "Some form",
                contents: {
                  a!textField(label: "Comments", readOnly: true),
                  a!textField(label: "Start Date", readOnly: true),
                  a!textField(label: "End Date", readOnly: true),
                  a!textField(label: "Emial", readOnly: true),
                  
                }
              ),
              a!buttonLayout(
                primaryButtons: {
                  a!buttonWidget(label: "approve"),
                  a!buttonWidget(
                    label: "reject",
                    value: "reject",
                    saveInto: local!pressedButton
                  )
                },
                secondaryButtons: { a!buttonWidget(label: "cancel") }
              )
            },
            showWhen: local!pressedButton = "cancel"
          ),
          /*Interface 2*/
          a!sectionLayout(
            contents: {
              a!boxLayout(
                label: "Some form",
                contents: {
                  a!paragraphField(label: "Comments", readOnly: true)
                }
              ),
              a!buttonLayout(
                primaryButtons: {
                  a!buttonWidget(
                    label: "cancel",
                    value: "cancel",
                    saveInto: local!pressedButton
                  ),
                  a!buttonWidget(label: "submit")
                }
              )
            },
            showWhen: local!pressedButton = "reject"
          )
        }
      )
    )
      

    sabat0002Author
    May 23, 2023

    Thank you ,It worked