I thought I'd post this code in case it's useful to anyone
else. Using an older version of RBase where I needed to
create a 2-column report, here's the code to get the data
into a temp table, which is what the report is then based
off of. This will print the columns ACROSS, not down.
Karen
DROP TABLE tmpCandle1
-- Put the columns you need in this table, plus one extra integer column
-- for an autonumber
CREATE TEMP TABLE tmpCandle1 +
(MemberID INT, Relation TEXT 14, YName TEXT 30, tmpNumber INT)
AUTONUM tmpNumber IN tmpCandle1 USING 1
-- The ORDER BY is important because it will control how it's printed
-- in your report
INSERT INTO tmpCandle1 (memberid, relation, yname) +
SELECT MemberID, Relation, YName FROM ylist +
WHERE ...... ORDER BY yday
DROP TABLE tmpCandle
-- Create a table with same columns as above, but with a duplicate set of
-- each; also has the extra integer field for autonumber
CREATE TEMP TABLE tmpCandle +
(MemberID INT, Relation TEXT 14, YName TEXT 30, +
MemberID2 INT, Relation2 TEXT 14, YName2 TEXT 30, +
tmpNumber INT)
AUTONUM tmpNumber IN tmpCandle USING 1
-- this gets all the odd# of rows into the table
INSERT INTO tmpCandle (MemberID, Relation, YName) +
SELECT MemberID, Relation, YName FROM tmpCandle1 +
WHERE (MOD(tmpNumber,2)) <> 0
-- What you're doing is updating Row 1 of tmpCandle with
-- row 2 data from tmpCandle1
SET VAR fvLoop INT = 2, fvCount INT = 1
WHILE 1 = 1 THEN
UPDATE tmpCandle SET MemberID2 = t2.MemberID, Relation2 = t2.Relation, +
YName2 = t2.YName +
FROM tmpCandle t1, tmpCandle1 t2 +
WHERE t1.tmpNumber = .fvCount AND t2.tmpNumber = .fvLoop
IF xError <> 0 THEN
-- no more rows to update
BREAK
ENDIF
SET VAR fvLoop = (.fvLoop + 2), fvCount = (.fvCount + 1)
ENDWHILE

