Skip to main content
October 24, 2024
Question

Multiple 'saveinto' not working with condition in button widget

  • October 24, 2024
  • 5 replies
  • 0 views

                  a!columnLayout(
                    contents: {
                      a!buttonArrayLayout(
                        buttons: {
                          a!buttonWidget(
                            label: "Next",
                            size: "LARGE",
                            style: "SOLID",
                            saveInto: {
                              if(
                                len(ri!checklists) > 1,
                                {
                                  a!save(ri!steps, append(ri!steps, "name")),
                                  a!save(ri!nextStep, 3)
                                },
                                {
                                  a!save(
                                    local!showAddChecklistErrorMessage,
                                    true()
                                  )
                                }
                              )
                            }
                          )
                        },
                        align: "END",
                        marginBelow: "NONE"
                      )
                    }
                  )

Here is the code, I have button with save something based on a condition, now within this 2 save statement 

a!save(
ri!steps,
append(ri!steps, "name")
),
a!save(ri!nextStep, 3)
only first one is working next is not working. Let me know what I am doing wrong

5 replies

somasundaram.d
October 24, 2024

What was the issue

October 25, 2024

a!save(ri!nextStep, 3) not changing the value

vishalg0003
October 25, 2024

Its because the 2nd a!save has wrapped inside {}. 

a!columnLayout(
contents: {
a!buttonArrayLayout(
buttons: {
a!buttonWidget(
label: "Next",
size: "LARGE",
style: "SOLID",
saveInto: {
if(
len(ri!checklists) > 1,
{
a!save(ri!steps, append(ri!steps, "name")),
a!save(ri!nextStep, 3)
},
a!save(
local!showAddChecklistErrorMessage,
true()
)
)
}
)
},
align: "END",
marginBelow: "NONE"
)
}
)


October 25, 2024

The problem with the `len` function and the login must be >=,. The correct function for the length of the array in `length`, and after changing the logic to >= now it is working as expected.