Another strong advantage of groovy scripting is that you can access application dimensions and create dynamic list of members that your algorithm requires on the fly. It is quite easy to access list of members by using .getEvaluatedMembers() function as follows.

Cube cube = operation.application.getCube("CubeName");
Dimension pdim = cube.getApplication().getDimension('Product');
List<Member> allProducts = pdim.getEvaluatedMembers('ILvl0Descendants(Total Product)',cube)

It is also possible to use attribute members in .getEvaluatedMembers() function.

List<Member> list1 = pdim.getEvaluatedMembers('Big',cube)
List<Member> list2 = pdim.getEvaluatedMembers('Blue',cube)

list1 is having Big products. list2 is having Blue products. If you need a list where you want to access Big and Blue products, you can simply rely on .intersect() function.

List<Member> list3 = list1.intersect(list2)

You can use the list as usual. For example to see number of products with those attributes.

list3.size()

Perhaps check if the list is empty and throw an error.

if(list3.size()==0){
   throwVetoException("No Products Found.")
}

You may need to iterate through the list and process Big and Blue products.

list3.each{
   println(it.toString())
   …
}

This example prints all products in list3 to the log.