Enumerate Function

Description:
Returns a list by enumerating all the combinations formed by taking one element from each list at a time.
For example, in a situation where you have two products that come in 3 sizes, you can use this function to get a list of all the possible combinations (see below).
In general if n number of lists (L1, L2, ... Ln) are passed to Enumerate, the result will be a list of lists, where each inner list is of length n, and the outer list will have length which is count(L1) * count (L2) * ... * count(Ln).
From this you can see that if any input list is of length zero then the result will be of length zero (the empty list).
Returns:
Any**
Parameters:
Parameter
Data Type
Description
*
Any*
Any number of input lists
Examples:
Expression
Result
Enumerate( List(1, 2), List(3, 4) )
List(List(1, 3), List(1, 4), List(2, 3), List(2, 4))
Enumerate( List("Shirt", "Trousers"), List("S", "M", "L") )
List(List("Shirt", "S"), List("Shirt", "M"), List("Shirt", "L"), List("Trousers", "S"), List("Trousers", "M"), List("Trousers", "L"))
Enumerate( List("Alpha", "Beta"), List("1", "2"), List("red", "yellow", "blue") )
List(List("Alpha", "1", "red"), List(“Alpha", "1", "yellow”), List("Alpha", "1", “blue"), List(“Alpha”, "2”, "red”), List("Alpha", "2", "yellow"), List("Alpha", “2”, “blue”), List("Beta", "1", "red"), List("Beta", "1", "yellow"), List("Beta", "1", "blue"), List("Beta", "2", "red"), List("Beta", "2", "yellow"), List("Beta", "2", "blue"))

Related content