Click to See Complete Forum and Search --> : Complex nested loop?


hastx
04-07-2007, 06:17 PM
I have to find a way to extract product data for clothing from a spreadsheet at work and assign each possible combination a unique id for use with a shopping cart.

The spreadsheet records look like this:

Item_name|Item_descrip|sizes_available|options_available|base_price

or more specifically:

Item_name|Item_descrip|Small,Med,X-large|Logo, Initials, etc.|base_price

The problem is that there are several sizes_available(separated by commas)in the one cell & there might be several options available in the other cell, again seperated by commas.

The reason I want to automate this is because if you have 6 sizes and 3 options per record...that represents 18 unique products.

I'd like to export the data to a flat file to rewrite & work with, but I am trying to figure out how to rewrite the file to display each possible combination on it's own line with it's own number, and am wondering about the best way to form the looping to:
Check each line, Gather the sizes & Gather the options and re-write them so there is a single unique product on each line.

Any direction would be helpful, I'm getting lost thinking of how to set up the looping...but that may not even be the best way to go.