Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to iterate through rows in csv file and combine each row to records in another csv file?

I have two csv files. One csv has contract header information (ex. Customer, Start Date, End Date). The Second csv file has the detail information (item, price, etc.).  There is no common key between the two files, but it does not matter (yet) because each header in the first csv file should be mapped to all of the items in the 2nd csv file. 

 

I am trying to load the information into a mySQL database. In the database there is a header table and a detail table. The part I am not sure how to handle is mapping the two files together. Im thinking that I would need to iterate through the header file and then pull all records from the 2nd file. 

 

This is what I have so far, but the header row is being multiplied for each line. 

0683p000009MZzM.png

Labels (3)
3 Replies
Anonymous
Not applicable
Author

Hi
When you do join on tMap, if you don't set any keys, the output table will contain the number of rows = no.(main rows) * no.(lookup rows)
What are you expected result? Can you take some example data to explain your requirement? So I can give you more accurate answers.

Regards
Shong
Anonymous
Not applicable
Author

Thanks for the reply!

 

INPUT FILES

Header File 

  1. OneCustomerID,OneCustomerName, OneStartDate, OneEndDate
  2. TwoCustomerID,TwoCustomerName, TwoStartDate2, TwoEndDate

Item File

  1. A_ItemID,A_ItemName, A_Price, A_Status
  2. B_ItemID,B_ItemName, B_Price, B_Status
  3. C_ItemID,C_ItemName, C_Price, C_Status

 

OUTPUT

1. OneCustomerID,OneCustomerName, OneStartDate, OneEndDate

  • A_ItemID,A_ItemName, A_Price, A_Status
  • B_ItemID,B_ItemName, B_Price, B_Status
  • C_ItemID,C_ItemName, C_Price, C_Status

2. TwoCustomerID,TwoCustomerName, TwoStartDate2, TwoEndDate

  • A_ItemID,A_ItemName, A_Price, A_Status
  • B_ItemID,B_ItemName, B_Price, B_Status
  • C_ItemID,C_ItemName, C_Price, C_Status

 

The above is an idea of the output i'm expecting, but I am having trouble figuring out how to join the records in this way. I've tried adding a column called "ID" to each of the two files and I put a "1" in this field for all the rows. After doing this I was able to use the tMap to join the files, but its basically doing as you say main rows * look up rows.

Anonymous
Not applicable
Author

You need to iterate each row of header file. In your example output, the lines 1 and 2 will be inserted into different table or the same table?