How to remove an item from a list depending of a field value

Certified Senior Developer

Hi,

I would like to remove an item from a list, depending on a field (here, the condition is : when the "checked" field is false, I need to remove the item) :

/* Set to null the unchecked Vehicles items */
a!forEach(
  items: ri!vehicles,
  expression: if (rule!SHARED_IsFalse(fv!item.checked),
    a!save(fv!item, null),
    a!save(fv!item, fv!item)
  )
),
/* Remove the null items */
a!save(ri!vehicles, reject(fn!isnull, ri!vehicles)),


1/ How would you code it in a single instruction please ?  (with a foreach and a remove ?)

2/ From a SaveInto of an interface the code above works fine, but now I'm trying to execute it from an Expression Rule. So, how would you code this instruction "a!save(fv!item, null)", as a!save cannot be used in ER ?

I've tried to use the function updateDictionary(), but I do not see how to set an item to null (I can just set some fields to a null value).

I'm sure the answer of the first question can make the 2/ completely unnecessary ;-)


Regards

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data