I have a problem which I thought was really easy to solve but now I am here =)
I need to construct a final combination of a content based on combinations of various sub-contents. A sub content is a group of items which can be varied in combinations. The example below lists each groups possible combinations not the items in the group that make up the combinations.
The number of sub-contents can vary to any integer. The number of combinations in a sub-content can also vary to any integer.
Example.
Sub-content:x -> 4 combinations Xa,Xb,Xc,Xd
Sub-content:y -> 10 combinations Ya,Yb,Yc,Yd,Ye,Yf,Yg,Yh,Yi,Yj
Sub-content:z -> 3 combinations Za,Zb,Zc
where
These three different sub-contents will construct the whole content and should result in 4 * 10 * 3 = 120 combinations, right?
Combination 1 should be Xa,Ya,Za and combination 5 should be Xa,Yb,Za etc
1 2 3 4 5 .. 14 .. 120
X a b c d a b
Y a a a a b d
Z a a a a a a
Seems like an easy enough task to calculate but I cant manage to get it right.
I need a way to calculate which sub-contents a specific combination (1-120) is based upon
Thankful for any assistance and excuse me for not knowing the correct terms.