We are currently performing maintenance on Appian Community. As a result, discussions posts and replies are temporarily unavailable. We appreciate your patience.
Hello,
I've created a datasubset using a!foreach. Now want to filter the data on the datasubset depending on the value for one field. Can you please suggest on this?
a high level snippet is below. Below rule returns a datasubset & on that datasubset I am trying add a filter.
todatasubset(
a!forEach( items: rule!Irulename(), expression: 'type!{urn:com:appian:types:cdt}|cdt_name'(fields:, completed: rule!newRuleToupdateafield ))
)
Discussion posts and replies are publicly visible
I'm not sure what the requirements are of the "filtering" you want to perform, but in general, you can use a!forEach() to loop over items in any array (including dictionaries, CDTs, etc), and any items that don't match the condition you want, just return the empty set "{}".
Note: If there's a chance that all rows may be filtered out under any condition, you need to wrap the whole thing in "a!flatten()" as well, since otherwise using the above technique would return a list of empty sets specifically when all results are empty sets (otherwise it performs as expected).
Thank you Mike. Your suggestion was helpful.
Thanks! I would also appreciate a "verify answer" click if you're satisfied.