Skip to main content

17 replies

Inspiring
Aug 25, 2022 5:00 AM UTC

Could you please elaborate your requirement? Why you are looking for while and do while logics?

shreeharshan0678
Known Participant
Aug 25, 2022 5:26 AM UTC

Consider I have an integer as a input and I apply condition on that integer. If condition returns true then end of the loop, else again check the condition with decremented value of integer. 

stewart.burchell
Employee
Aug 25, 2022 7:57 AM UTC

As others have said you cannot break out of a loop in Appian, you have to let it run to the end of the provided list. Typically what I do is output 'null' when my condition is not met, and the value I do want when the condition is met, and then remove the nulls from the generated list.

shreeharshan0678
Known Participant
Aug 25, 2022 9:01 AM UTC

Thank you, I will look into that.

stewart.burchell
Employee
Aug 25, 2022 9:07 AM UTC

Here's trivial example to illustrate the idea:

fn!reject(
  a!isNullOrEmpty,
  a!localVariables(
    local!myList: fn!enumerate(10) + 1,
    a!forEach(
      items: local!myList,
      expression: if(fv!item = 5, fv!item, null)
    )
  )
)