Hello,

I've really been struggling with the following problem for a couple of days and I'd appreciate any suggestions any of you may have...

I have an object that can have up to 4 properties. The object represents a general Product that we are selling in our store, and the properties are used to differentiate the products. For example...

Product Object: Men's Shirt
Property 1: Size (Small, Medium, Large)
Property 2: Color (Red, Blue, Black)
Property 3: Type (T-shirt, Sweater, Hooded)
Property 4: In-Stock (Yes, No)

The properties are not the same for each product and can be changed by the user to reflect the properties of different products as needed. For example...

Product Object: Custom Baseball Cap
Property 1: Adjustible Fit (Yes, No)
Property 2: Logo - Designed by the customer
Property 3: In-Stock (Yes,No)

The above baseball hat comes in only 1 color and 1 size so it does not need to have a Size or Color property. The logo is designed by the customer.

For inventory purposes, I need a way to find a way to obtain all combinations of properties for a give object...
Code:
Product            Size          Color         Type         In-Stock
Men's Shirt       Small           Red           Shirt        Yes
Men's Shirt       Small           Red           Shirt         No      
Men's Shirt       Small           Red           Sweater       Yes
etc...
I've been looking into combinations and permutations, which I believe would work except for the fact that sometimes a Property may not be used by a product. It is easy enough to put every value of each property into an array and loop through each one...
Code:
for int1 = 0 to ubound(arrProperty1)
     for int2 = 0 to ubound(arrProperty2)
          for int3 = 0 to ubound(arrProperty3)
               for int4 = 0 to ubound(arrPropery4)
                    'process this unique combination...
                     str1=arrProperty1(int1)
                     str2=arrProperty2(int2)
                     str3=arrProperty3(int3)
                     str4=arrProperty4(int4)
               next
          next
     next
next
I think that the above solution would work if I always knew that every object had 4 properties, but how would I do it if an object has less than 4 properties. Also, it is possible for Property 1 to be undefined, but Properties 2, 3, and 4 are in use. Or it is possible that Property 2 and 3 are defined for an object but 1 and 2 are not, etc...

I'd appreciate any insight in the matter or a push in the right direction. I'd be glad to elaborate if more information is required.