Building 2 tables from 1 (AREV Specific)
At 10 FEB 2000 05:32:20PM ********* Mike Daniel ***** wrote:
Hey guys, sorry so brain dead today trying to fight off the flu and
I can't think well enough to unwrap a peice of candy. Heres the skinny. Table 1 is the Main table, Table 2 & 3 are new tbl's created
by data in Table 1. I want to open the 3 tables read the recs from
tbl#1 and take the key and field #1 and stuff it into T1REC. I want to take the Key again and field #2 and stuff it into T2REC.
The key to the 2 new tables are the Key and the field value. Yes
MultiPart keys. no other data just the keys..Could some one please
help with a snip of quick code or please E-Me a bullet so I can sleep.. Thanks a Million
At 10 FEB 2000 09:50PM Bill Titus wrote:
NULL="
OPEN "TABLEONE_NAME" TO T_ONE ELSE FSMSG() ; STOP
OPEN "TABLETWO_NAME" TO T_TWO ELSE FSMSG() ; STOP
OPEN "TABLETHREE_NAME" TO T_THREE ELSE FSMSG() ; STOP
EOF=0
SELECT T_ONE
LOOP
READNEXT ID ELSE EOF=1WHILE EOF=0
READ REC FROM T_ONE,ID THENWRITE NULL ON T_TWO,ID:"*":RECWRITE NULL ON T_THREE,ID:"*":RECENDREPEAT
Is this about what you had in mind?
At 11 FEB 2000 09:28AM ********* Mike Daniel ********* wrote:
Bill Why use the Write "Null" and not
Write AREC on T_TWO, ID:"*":REC
Write AREC on T_Three, ID:"*":REC
Are you just using null to represent the new rec
name fo the new tables?
BTW Thanks a Million for your help..
Mike
At 11 FEB 2000 09:54AM ***** Mike Daniel *** wrote:
Bill, I am deeply sorry but I did forget one not so minor detail.
table 1 structure Table 2 & 3
key=single value Key=T1 key * REC /REC
REC MV REC MV the Data in the MV fields REC & REC
It is basicly like you posted but the REC & REC are MV
so I need to know how to Grab the Key to T1 and then the first VAL
in REC, then create and new record with it in T2 then Grab the
next VAL of REC and make the 2nd record ect.
Sorry again Mike.. [email protected]
At 11 FEB 2000 12:03PM Matt Sorrell wrote:
Mike,
Allow me to suggest a slight modification that should handle what you need.
NULL="
OPEN "TABLEONE_NAME" TO T_ONE ELSE FSMSG() ; STOP
OPEN "TABLETWO_NAME" TO T_TWO ELSE FSMSG() ; STOP
OPEN "TABLETHREE_NAME" TO T_THREE ELSE FSMSG() ; STOP
EOF=0
SELECT T_ONE
LOOP
READNEXT ID ELSE EOF=1
WHILE EOF=0
READ REC FROM T_ONE,ID THEN
VAL1.COUNT=COUNT(REC,@VM) + (REC # "")
FOR Z=1 TO VAL1.COUNT
WRITE NULL ON T_TWO,ID:"*":REC
NEXT Z
VAL2.COUNT=COUNT(REC,@VM) + (REC # "")
FOR Z=1 TO VAL2.COUNT
WRITE NULL ON T_THREE,ID:"*":REC
NEXT Z
END
REPEAT
This should loop through each MV in fields 1 and 2, and create separate records in tables 2 and 3 respectively.
Matt Sorrell
At 11 FEB 2000 01:59PM ******* Mike Daniel ******* wrote:
Matt my man , you hit it on the money.
Dude, Thanks a whole lot for your help. How many yrs hawe
you dabbeled in Arev?
My email addy's are
work [email protected]
home [email protected]
Contact me when you get a chance.. I get SUB Cont. work all the time.
Mike
At 11 FEB 2000 02:14PM Bill Titus wrote:
Mike,
You asked:
Why use the Write "Null" and not
Write AREC on T_TWO, ID:"*":REC
Write AREC on T_Three, ID:"*":REC
Are you just using null to represent the new rec
name fo the new tables?
Variables need to be assigned a value in order to be used in RBasic. Whether you use AREC=" or NULL=" to represent the null (empty) record you wish to save as ID:"*":REC:"/":REC, it must first be assigned a value - even if the value is null.
Did Matt's handling of the multi-values do the trick for you?
Bill
At 11 FEB 2000 04:08PM ** Mike Daniel ** wrote:
Yes, Bill it did and I thank you both very much for your help.
Thanks again Guys..
Mike