You broke the expression. Here I fixed it: {audios.collect{ a -> allOf{[any{a.CodecIDHint}{a.Codec}, a.Channels+'ch']}{a.Language} }.findAll{ it[1] }.groupBy{ it[0] }.collect{ k, v -> k + v*.get(1) }.flatten().join('.') }
See how the groupBy key is a Array of Codec/Channels. :ugeek:
I tried this: {audios.collect{ a -> allOf{any{a.CodecIDHint}{a.Codec}}{a.Language} }.findAll{ it[1] }.groupBy{ it[0] }.collect{ k, v -> k + v*.get(1) }.flatten().join('.') } but get no value (just blank).
I also tried: {audios.collect{ a -> allOf{[{if (a ...
This is how I'd write that: {audios.collect{ a -> allOf{[a.codec, a.channels+'ch']}{a.Language} }.findAll{ it[1] }.groupBy{ it[0] }.collect{ k, v -> k + v*.get(1) }.flatten().join('.') }
If you use a binding that is undefined/null/etc it'll cause an Exception to be thrown. So you can catch that ...