0

I have a bit weired scenario where i need to fetch data

i have following three products

   product1,product2,product3 

and each product has different ids(e.g. p1345,p3453,p2345) and then each froduct have different options which are having different skus

   product1 - option1(sku234),option2(sku345)
   product2 - option1(sku1001)
   product3 - option1(sku0022),option2(sku0033)

so if i store products in one csv file and options in other csv file,how can i fetch the relevant skus from the option file.

2
  • Why do you want to store these details in a CSV file. You can as well use Java collection classes like HashMap with key as product name and Value consisting of a list contains options. Commented May 15, 2015 at 17:34
  • i need to pass those values in jmeter Commented May 15, 2015 at 17:37

1 Answer 1

1

Can you explain how the 2 CSV files will be structured?

How about something like this?

products.csv

Each row will contain: Product ID, Option Code 1, Option Code 2, Option Code 3, etc.

options.csv

Each row will contain: Product ID, Option Code, SKU

..so you look up a product ID (e.g. p1345) in products.csv to get a list of possible option codes for that product, then for each option code in the list, look it up (along with the product ID) in options.csv to obtain the SKU that is specific to that product/option pair.

So as a simple example, given the structure just described, if products.csv contains just 1 record: p1345, option1, option 2

..and options.csv contains these 2 records: p1345, option1, sku234 p1345, option2, sku345

..and given the product ID "p1345", by parsing both CSV files your code would figure out that the 2 valid SKUs for this product ID are "sku234" and "sku345".

Hope that makes sense, just checking my understanding is correct.

Sign up to request clarification or add additional context in comments.

3 Comments

first file is products.csv where it contains list of all the products(column1row1 = product1,column1row2=product2 and so on) and second file is options.csv(column1row1=option1,column2row1=option2(that is for product1) and in second line it is for product2(Column1row1=option1) and in third row it is for product3 which is similar to product1 options
it does make sense but i was looking for if someone can help me with code because i am not an expert in java.
No problem, something like this should help: stackoverflow.com/questions/13433407/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.