Another observation is that all the variables should be defined and value type set
before the defining of the cursors. In the older versions of R:BASE you could get away with letting the cursor define your variables but it is less forgiving now. -----Original Message----- From: "Dan Goldberg" <[email protected]> To: [email protected] (RBASE-L Mailing List) Date: Thu, 21 Jun 2012 06:17:57 -0700 Subject: [RBASE-L] - Re: labels not showing The first thing that stands out is you missing a period on the right hand side of the if statement IF vCNumber2 <> vCNumber1 THEN Should be IF vCNumber2 <> .vCNumber1 THEN Dan -----Original Message----- From: Jim Belisle Sent: Thursday, June 21, 2012 4:23 AM To: RBASE-L Mailing List Subject: [RBASE-L] - Re: labels not showing I appreciate all the comments on this problem. As best I can tell it is a data corruption problem. I have pasted the code I use below so if anyone has a suggestion on making the code better, I am open to that. -- Get date for shipping labels SET VAR vBOLDate DATE = NULL SET VARIABLE vBOLDate = (GETDATE('Select Date for Shipping Labels')) IF vBOLDate IS NULL THEN GOTO done ENDIF CLS -- Set up variables used in processing. -- Drop then create temp table for processing rows to print. SET ERROR MESSAGE 2038 OFF DROP TABLE tbollabels SET ERROR MESSAGE 2038 ON CREATE TEMP TABLE tbollabels (lblitem INTEGER, boldate DATE, BOLNumber TEXT 15, + ordernumber TEXT 20, lblpcs INTEGER, packagewgt REAL) -- Declaring two cursors to capture information. DECLARE cbolqty CURSOR FOR SELECT boldate, BOLNumber, BOLPackages + FROM BOLHeader WHERE BOLDate = .vBOLDate OPEN cbolqty FETCH cbolqty INTO vbdate INDIC vi1, vcnum INDIC vi2, vbolqty INDIC vi3 DECLARE cbollbl CURSOR FOR SELECT boldate, BOLNumber, ordernumber, + packageqty, packagewgt FROM bolrows WHERE BOLDate = .vBOLDate -- AND shipdate IS NULL OPEN cbollbl FETCH cbollbl INTO vbdateu INDIC vi4, vcnumu INDIC vi5, vordnum INDIC vi6, + vpcs INDIC vi7, vpkgwgt INDIC vi8 SET VAR vCNumber1 = .vCnum SET VAR vCNumber2 = 0 -- Processing rows with a WHILE LOOP. WHILE SQLCODE <> 100 THEN IF vCNumber2 <> vCNumber1 THEN AUTONUM lblitem IN tbollabels USING 1 1 NONUM ENDIF WHILE vbolqty > 0 THEN WHILE vpcs > 0 THEN INSERT INTO tbollabels (boldate, BOLNumber, ordernumber, lblpcs, packagewgt) + VALUES (.vbdateu, .vcnumu, .vordnum,1, .vpkgwgt) SET VAR vpcs = (.vpcs - 1) SET VAR vbolqty = (.vbolqty - 1) ENDWHILE FETCH cbollbl INTO vbdateu INDIC vi4, vcnumu INDIC vi5, vordnum INDIC vi6, + vpcs INDIC vi7, vpkgwgt INDIC vi8 ENDWHILE SELECT BOLNumber INTO vCNumber2 FROM tBOLlabels WHERE COUNT = INSERT FETCH cbolqty INTO vbdate INDIC vi1, vcnum INDIC vi2, vbolqty INDIC vi3 SET VAR vCNumber1 = .vcnum ENDWHILE -- Drop cursors. DROP CURSOR cbollbl DROP CURSOR cbolqty -- Print labels. LBLPRINT BOL_newlbltest + OPTION SCREEN + |WINDOW_STATE MAXIMIZED + |ZOOM_TYPE PERCENTAGE|ZOOMPERCENT 100 James Belisle Making Information Systems People Friendly Since 1990 --- RBASE-L =======================3D======================= D= TO POST A MESSAGE TO ALL MEMBERS: Send a plain text email to [email protected] (Don't use any of these words as your Subject: INTRO, SUBSCRIBE, UNSUBSCRIBE, SEARCH, REMOVE, SUSPEND, RESUME, DIGEST, RESEND, HELP) =======================3D======================= D= TO SEE MESSAGE POSTING GUIDELINES: Send a plain text email to [email protected] In the message SUBJECT, put just one word: INTRO =======================3D======================= D= TO UNSUBSCRIBE: Send a plain text email to [email protected] In the message SUBJECT, put just one word: UNSUBSCRIBE =======================3D======================= D= TO SEARCH ARCHIVES: Send a plain text email to [email protected] In the message SUBJECT, put just one word: SEARCH-n (where n is the number of days). In the message body, place any text to search for. =======================3D======================= D=

