From the beautiful land of Southern California! I've been looking into previous posts, but have been unable to find some code. I need help figuring out this problem. My main goal is to transfer data from 1 table (T1) into another table (F1). A client gives me a file with codes and the quantities for each code.
Example of text file given by client:
Code,Qty
A01,541
A02,234
A03,702
A04,300
and so on...
I am to print a report every 100 pieces. I already made a program that does the operations and splits it by 100's. Table T1 shows what I have so far:
Table T1
Code1 TQty Q1 Q2 Q3 Q4 Q5 Q6 Q7
A01 341 100 100 100 41
A02 234 100 100 34
A03 502 100 100 100 100 100 2
A04 300 100 100 100
I need to copy each field Q1, Q2, Q3, etc. to table F1 and each of those values needs to be a single record. My end result should look like below:
Table F1
Code1 Qty
A01 100
A01 100
A01 100
A01 41
A02 100
A02 100
A02 34
A03 100
A03 100
A03 100
A03 100
A03 100
A03 2
A04 100
A04 100
A04 100
I have to do it this way because we use a special Report writer to print the reports. It allows me to only print from single fields.
1. Do I copy the entire T1 table to an array and then copy each element to table F1?
I've been looking into
INSERT INTO F1(qty) VALUES (array1(1,5))
INSERT INTO F1(qty) VALUES (array1(1,6))
...
I'm thinking of checking empty elements with
IF EMPTY(array1(1,8))
***code
ENDIF
But how do I tie all of it?
2. Is it better to use a FOR...LOOP along with SCATTER & GATHER? Never have used these commands, but I can look into them. Have to figure out how to copy a specific cell from 1 table into another specific cell of a second table.
Maybe I'm over-complicating it. All I need are some ideas.
Using VFP 9
Thanks as always.
*Have to go back to work. I'll be checking back later this evening.
Example of text file given by client:
Code,Qty
A01,541
A02,234
A03,702
A04,300
and so on...
I am to print a report every 100 pieces. I already made a program that does the operations and splits it by 100's. Table T1 shows what I have so far:
Table T1
Code1 TQty Q1 Q2 Q3 Q4 Q5 Q6 Q7
A01 341 100 100 100 41
A02 234 100 100 34
A03 502 100 100 100 100 100 2
A04 300 100 100 100
I need to copy each field Q1, Q2, Q3, etc. to table F1 and each of those values needs to be a single record. My end result should look like below:
Table F1
Code1 Qty
A01 100
A01 100
A01 100
A01 41
A02 100
A02 100
A02 34
A03 100
A03 100
A03 100
A03 100
A03 100
A03 2
A04 100
A04 100
A04 100
I have to do it this way because we use a special Report writer to print the reports. It allows me to only print from single fields.
1. Do I copy the entire T1 table to an array and then copy each element to table F1?
I've been looking into
INSERT INTO F1(qty) VALUES (array1(1,5))
INSERT INTO F1(qty) VALUES (array1(1,6))
...
I'm thinking of checking empty elements with
IF EMPTY(array1(1,8))
***code
ENDIF
But how do I tie all of it?
2. Is it better to use a FOR...LOOP along with SCATTER & GATHER? Never have used these commands, but I can look into them. Have to figure out how to copy a specific cell from 1 table into another specific cell of a second table.
Maybe I'm over-complicating it. All I need are some ideas.
Using VFP 9
Thanks as always.
*Have to go back to work. I'll be checking back later this evening.