Expression evaluation error at function a!formLayout

Certified Associate Developer

Hi team,

i am refering appian application tutorial

i have interface 1 and interface 2, i wanna reuse  interface 2 into into interface 1...but shows error like this.....Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function a!formLayout [line 4]: The contents field on a column layout cannot contain a form layout. Received a form layout at index 4.

INTERFACE 1

a!localVariables(
local!readOnly: ri!step="APPROVAL",
local!labelPosition: if(local!readOnly, "ADJACENT","ABOVE"),
a!formLayout(
label: if(local!readOnly, "Approve expense Report", "Submit Expense Report"),
contents: {
a!textField(
label: "Expense Item",
labelPosition: local!labelPosition,
value: ri!expenseItem,
saveInto: ri!expenseItem,
refreshAfter: "UNFOCUS",
required: not(local!readOnly),

validations: {}
),
a!dateField(
label: "Expense Date",
labelPosition: local!labelPosition,
value: ri!expenseDate,
saveInto: ri!expenseDate,
required: not(local!readOnly),

validations: {}
),
a!floatingPointField(
label: "Expense Amount",
labelPosition: local!labelPosition,
value: ri!expenseAmount,
saveInto: ri!expenseAmount,
refreshAfter: "UNFOCUS",
required: not(local!readOnly),
validations: {}
),

/*a!paragraphField(*/
/*label: "comments",*/
/*labelPosition: local!labelPosition,*/
/*value: ri!comments,*/
/*saveInto: ri!comments,*/
/*refreshAfter: "UNFOCUS",*/
/*height: "MEDIUM",*/
/*showWhen: ri!expenseAmount > 100,*/
/*required: not(local!readOnly),*/
/*readOnly: local!readOnly,*/
/*validations: {*/
/*if(len(ri!comments)<=100, null, "Your text has exceeded 100 characters")*/
/*}*/
/*),*/


rule!AT_enterComments(
showWhen: ri!expenseAmount > 100,
labelPosition: local!labelPosition,
readOnly: local!readOnly,
required: not(local!readOnly),
commentValue: ri!comments,
commentSaveInto: ri!comments
),



a!radioButtonField(
label: "Radio Buttons",
labelPosition: "COLLAPSED",
choiceLabels: {"Approve", "Reject"},
choiceValues: {true, false},
value: ri!approve,
saveInto: ri!approve,
showWhen: local!readOnly,
required: true,
choiceLayout: "STACKED",
validations: {}
)
},

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",
showWhen: not(local!readOnly),
validate: false
)
}
)
)
)

INTERFACE 2

a!formLayout(
label: "Form",
contents: {
a!paragraphField(
label: "Comments",
labelPosition: ri!labelPosition,
value: ri!commentValue,
saveInto: ri!commentSaveInto,
refreshAfter: "UNFOCUS",
height: "MEDIUM",
showWhen: ri!showWhen,
required: ri!required,
readOnly: ri!readOnly,
validations: if(len(ri!commentSaveInto)<=100, null, "Your text has exceeded 100 characters")

)
},
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
)
}
)
)

 

  Discussion posts and replies are publicly visible

  • Hi 

    Contents field on any layouts cannot contain a form layout.

    So just try removing a form layout from your interface 2 and then call it in the interface 1 like below

    Interface 2:

       a!paragraphField(
         label: "Comments",
         labelPosition: ri!labelPosition,
         value: ri!commentValue,
         saveInto: ri!commentSaveInto,
         refreshAfter: "UNFOCUS",
         height: "MEDIUM",
         showWhen: ri!showWhen,
         required: ri!required,
         readOnly: ri!readOnly,
         validations: if(len(ri!commentSaveInto)<=100, null, "Your text has exceeded 100 characters")
    
       )
     

    Interface 1:

    a!localVariables(
      local!readOnly: ri!step = "APPROVAL",
      local!labelPosition: if(local!readOnly, "ADJACENT", "ABOVE"),
      a!formLayout(
        label: if(
          local!readOnly,
          "Approve expense Report",
          "Submit Expense Report"
        ),
        contents: {
          a!textField(
            label: "Expense Item",
            labelPosition: local!labelPosition,
            value: ri!expenseItem,
            saveInto: ri!expenseItem,
            refreshAfter: "UNFOCUS",
            required: not(local!readOnly),
            validations: {}
          ),
          rule!Interface2(
            commentSaveInto:ri!comments,
            commentValue:ri!comments,                 
            showWhen: true,
            required:true(),
            readOnly: false()
          )
          
        },
        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",
              showWhen: not(local!readOnly),
              validate: false
            )
          }
        )
      )
    )