At 01:34 PM 7/3/2013, Bruce A. Chitiea wrote:

The Designer is great, and usually works beautifully. I'm certain it would
work here.

But I'm force-feeding myself on direct coding to get up to speed as quickly
as possible. The goal here is to have an unattended routine to import and
attach a general ledger code table to an existing table of glcoded
transactions.

The error 2801 persists despite:
1. Close/restart of RBase;
2. Use of IDQuotes;
3. PKey in place on glCode.glCodeID

My test code:

--file: cmd_TestAddFKey.rmd
--rbse: elmpass
--auth: bchitiea
--crea: 2013-0703

SET TRACE ON

DROP TABLE TransTest2

PROJECT TEMP TransTest2  +
FROM Transaction USING *

ALTER TABLE TransTest2  +
ALTER COLUMN TransID  +
INTEGER NOT NULL PRIMARY KEY

ALTER TABLE TransTest2  +
ADD COLUMN glCodeID INTEGER

UPDATE TransTest2 SET glCodeID = glCodeID  +
FROM glCode t1,TransTest2 t2  +
WHERE t2.glCode = t1.glCode

ALTER TABLE `TransTest2`  +
ADD FOREIGN KEY (`glCodeID`)  +
REFERENCES `glCode`

DROP COLUMN glCode from TransTest2

RETURN


Bruce,

Here's a simple test that you can try to understand the correct procedure.

01. After using the UPDATE TransTest2 SET glCodeID = glCodeID command ...

    Use the Data Designer (RBDefine) GUI interface to add the Foreign Key
    and save the table accordingly.

    If saved successfully ... then ...

02. At the R> Prompt, type the following command ...

    OUTPUT TransTest2.STR
    UNLOAD STRUCTURE FOR TransTest2
    OUTPUT SCREEN

03. Now open the text file using the R:BASE Editor ...

    RBEDIT TransTest2.STR

04. Carefully read the syntax.

That should certainly provide you with some blue's clues ...

Very Best R:egards,

Razzak.

www.rbase.com
www.facebook.com/rbase
--
30+ years of continuous innovation!
15 Years of R:BASE Technologies, Inc. making R:BASE what it is today!
--


Reply via email to