Appian Community and Appian Academy are being upgraded. From July 24–August 3, the Appian Community will be in read-only mode. During this time, the site will be read-only and user registration will be disabled. We apologize for any inconvenience this may cause, but a more secure, stable, and performant Community experience is coming soon!

The new Appian Community launches August 3, followed by Appian Academy on August 7. During the migration, Appian Community Edition, Appian Academy, Documentation, Certifications, Instructor-led Customer Training, Partner Sales Training & Accreditation, and Forum (for Appian Partners and Customers only) will remain available.

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