How to mutualize many list extractions in a same foreach

Certified Senior Developer

Hi,

I have a very simply code and need to make 2 things:

- create a first list that feet a condition

- create another list (exclusion) using the same condition

I would like to see how would you do using a single foreach please ?

a!localVariables(
  local!lst,
  local!goodVehicles: a!forEach(
    items: ri!vehicles,
    expression: if(and(
        fv!item.typeid = 1,
        fv!item.isavailable,
        not(fv!item.deleted)
      ),
      fv!item,
      {},
    )
  ),
  
  local!badVehicles: a!forEach(
    items: ri!vehicles,
    expression: if(and(
        fv!item.typeid = 1,
        fv!item.isavailable,
        not(fv!item.deleted)
      ),
      {},
      append(local!lst, fv!item),
    )
  ),
  {
    good: local!goodVehicles,
    bad: local!badVehicles
  }
)

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data