How to check for empty group?

Dear community,

I would like to filter a group by the item name, to be precise: whether an item name contains a certain string.
If this filtered group is empty, nothing should happen.
Otherwise on each of the filtered group’s elements something should happen.
I can’t get it to work, could you please support?

val jalousien = gJalousienZumLueften.members.filter[ jalousie | jalousie.name.toString.contains(raumName) ]
                if( jalousien.members != null){
                        // Open all relevant blinds of this room
                        jalousien.forEach[ jalousie |
                                // Do something with this "jalousie"
                        ]
                }

Cheers,
Oliver

Filtering a Group does not produce a Group it makes a list type object. That doesn’t have a .members method, your error message should be telling you about that.
Lists do have a .size method, which could be 0.

Brilliant! That worked.
It is a little bit tricky getting started in DSL. I am quite experienced in Java I would say but DSL feels so unfamiliar at the beginning and it is not as well documented as a typical javadoc.

However, with this forum and all the examples out there, I think I will get it done. :slight_smile: So thanks again!