Using local variable to add a section calling another interface on a button click

Certified Associate Developer

I had created an interface that calls another interface. Also, I had created a counter as a local variable that is incremented by 1 every time a button in the interface is pressed. On every button press I want to add a new section that calls the child interface. My problem is that on the first press only the child interface appears! So here is the code if you can help me

a!localVariables(
local!count: 1,
{
a!sectionLayout(
label: "Click the button to add a new Customer Currency section",
contents: {
a!buttonArrayLayout(
buttons: {
a!buttonWidget(
label: "Add new section below",
icon: "plus-circle",
value: local!count + 1,
saveInto: local!count,
size: "SMALL",
width: "FILL",
style: "PRIMARY"
)
},
align: "START"
)

}
),
if(local!count<>1,a!sectionLayout(
label: "",
contents: {
rule!C_CustomerCurrency(ri!Currency)
}
),"")


}
)

  Discussion posts and replies are publicly visible

Parents
  • +1
    Certified Senior Developer

    Try this

    a!localVariables(
    local!count: 1,
    {
    a!sectionLayout(
    label: "Click the button to add a new Customer Currency section",
    contents: {
    a!buttonArrayLayout(
    buttons: {
    a!buttonWidget(
    label: "Add new section below",
    icon: "plus-circle",
    value: local!count + 1,
    saveInto: local!count,
    size: "SMALL",
    width: "FILL",
    style: "PRIMARY"
    )
    },
    align: "START"
    )

    }
    ),
    if(local!count>0,
    a!foreach(
    items:enumerate(local!count)+1,
    expression:
    a!sectionLayout(
    label: "",
    contents: {
    a!textField(
    label:"test"
    )
    }
    )),"")


    }
    )

  • 0
    Certified Associate Developer
    in reply to Dharsana

    thanks a lot it worked. But a problem is still happening which is that the content of the textfield at the end of the code appears in all the called instances and once updated in one of the textfields it updates all of the others so do you have a solution for that?

Reply Children
No Data