Make sure that all variables are pre-defined such as:

SET VAR vShipToState TEXT = NULL

SET VAR vQuoteCount INTEGER = NULL

SET VAR vQuoteID INTEGER = NULL

 

 

  _____  

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Jim Belisle
Sent: Sunday, December 07, 2008 6:23 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Duplicating rows

 

 

I am attempting to duplicate rows in a Header table that makes sure the ID
number is unique.  I am now using the following process to try and duplicate
the rows but am running into a strange error.

 

1)       I bring the rows into both the Header and Detail temporary tables.
This is successful.

2)       I then want to change the ID number to a new number prior to
bringing up the form.  The ID number in my Entry form (which works) looks at
the combination of the present Date, the ship to State, and the Count to
create the ID number.  This must be unique.  Here is the code that works in
the Entry form:

 

-- Assign New Quote Number

   SET VAR vshiptostate = shiptostate IN tquoteheader WHERE quoteid =
.vquoteid

   SELECT (COUNT(*)) INTO vQuoteCount INDIC ivQuoteCount FROM QuoteHeader +

   WHERE QuoteDate = .#DATE AND ShipToState = .vShipToState

   IF vQuoteCount = 0 THEN

      SET VAR vQuoteCount = 1

   ELSE

      SET VAR vQuoteCount = (.vQuoteCount+1)

   ENDIF

   CLEAR VAR vquoteid

   SET VAR vquoteID = +

 
((TRIM(FORMAT(.#DATE,'MMDDYY')))+(TRIM(FORMAT(.vQuoteCount,'00')))+.vShipToS
tate)

   IF quoteid <> .vquoteid THEN

   UPDATE tquoteheader SET QuoteID = .vquoteid

   UPDATE tquotedetail SET QuoteID = .vquoteid

   ENDIF

 

Two errors are occurring that I cannot figure out.  One is the SELECT COUNT
is not adding a '2' to the new ID number.  The ID in the Header is already
(in this case) 120701IA so the new number should be 120702IA.  That is not
happening.

 

The second error is the program comes up with 'QuoteID is not a column or
variable' when I run the UPDATE command above.  Yet the rows were added to
the temp table using the very column 'QuoteID'! I have used watch variables
to see when the variables change.

 

If anyone is on line this weekend, your help would be appreciated.

 

Jim

 

 

 

Reply via email to