Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Seperating Field data and duplicating rows according to values..

Status
Not open for further replies.

woodyinoz

IS-IT--Management
Jan 8, 2002
215
GB
Ok here are two questions which I need to address.

1. I import a textfile and use comma as my seperator. However, one of the fields contains information which I would also like to split into seperate fields. This field currently holds both the weight and the width of the part i.e. 300x30 (300 wide & 30 thk). I want to seperate the two numbers into to serperate fields.

2. In the quantity field of my table, some parts have a great than 1 value. I want my database to read this value and generate the suffiecient amount of rows. I would also like to set the quantity value in all these rows to 1.
i.e. Quantity = 3, so duplicate the row twice to have 3 rows and change the quantity to 1.

Any help on these would be great.

Woody.
 
Woody,

1. I would certainly use a scan loop to accomplish the first one. Restructure the table to add the two new seperate fields. Open the table using a tCursor and start a scan loop. Use the breakApart() function to split the two values (using the X as the seperator).

2. Again, this could be done with a query and a scan loop. Do a query for those results greater than 1 and open the answer table and the original table, putting the answer table in the scan loop. Then use insertRecord() on the original table and fill the fields from the information in the answer table. Then do a changto query to set all the values in the original table to 1.

If you need help with the code, just ask.

Mac
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top