Jim,

I did not test this code but I think it should work.

SET VAR vBOLDate = 12/23/2009
Set VAR vPCS integer = 0
CREATE TEMP TABLE tBOLLabels (Lblitem INTEGER, BOLDate DATE, Control# TEXT
9,+
     OrderNumber TEXT 20, Lblpcs INTEGER, PackageWgt REAL,AutoNumberCol
Integer)
AUTONUM AutoNumberCol IN ctBOLLabels USING 1 1 NUM
DECLARE cBollbl CURSOR FOR SELECT BOLDate, Control# OrderNumber, PackageQty,
PackageWgt +
   FROM BOLRows WHERE BOLDate = .vBOLDate
OPEN cBollbl
FETCH cBollbl INTO vBdate INDIC vi1, vCnum INDIC vi2, vOrdNum INDIC vi3, +
vPcs INDIC vi4, vPkgwgt INDIC vi5
WHILE SQL <> 100 THEN
  WHILE vPcs > 0 THEN
    INSERT INTO tBollabels (BOLDate, Control#, OrderNumber, Lblpcs,+
    PackageWgt) VALUES (.vBdate, .vCnum, .vOrdNum, '1', .vPkgwgt)
    SET VAR vPCS = (.VPCS - 1)
  ENDWHILE
FETCH cBollbl INTO vBdate INDIC vi1, vCnum INDIC vi2, vOrdNum INDIC vi3, +
vPcs INDIC vi4, vPkgwgt INDIC vi5
ENDWHILE

John
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Jim Belisle
Sent: Thursday, December 24, 2009 7:34 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: shipping labels

Albert,

Forgive me for my ignorance.  I guess I do not understand why I would
get an error when the FETCH command works.  I was able to insert a row
into the table using the insert command without the WHILE command. See
below.

SET VAR vBOLDate = 12/23/2009
CREATE TEMP TABLE tBOLLabels (Lblitem INTEGER, BOLDate DATE, Control#
TEXT 9, OrderNumber TEXT 20, Lblpcs INTEGER, PackageWgt REAL)
DECLARE cBollbl CURSOR FOR SELECT BOLDate, Control# OrderNumber,
PackageQty, 
        PackageWgt FROM BOLRows WHERE BOLDate = .vBOLDate
OPEN cBollbl
FETCH cBollbl INTO vBdate INDIC vi1, vCnum INDIC vi2, vOrdNum INDIC vi3,
+
      vPcs INDIC vi4, vPkgwgt INDIC vi5
INSERT INTO tBollabels (BOLDate, Control#, OrderNumber, Lblpcs,
PackageWgt) +        VALUES (.vBdate, .vCnum, .vOrdNum, '1', .vPkgwgt)


Why would putting the WHILE code before the INSERT clause cause it not
to work?

Jim

This is all new to me so I have to muddle through this.
Sorry to be a bother.


Reply via email to