"forEach Loop" syntax for nested groups?

solved !

How can I delete a post in this forum ??

Hi community,

I have m-groups of n-items in a main-group :
group - group1 .-.item1…n
… - groupm - item1…n

In a rule triggerd by group received update I’d like to run a loop to access all the m*n - items like this:

            logInfo("debug",String::format("[%s.rules] %s : %s","rule-x",element2.name.toString,element2.state.toString))

How is the syntax for code in the second line to access a member of a group in a group ?
Documentations I red do not explain that scenario…


I think what you really want to use is group.allMembers which will recursively give you all the members of group and any other Groups that are also a member of Group. In short, you will get all the Items but none of the subgroups.

1 Like