Don't have any brilliant ideas for you. But if you need an example of a nested cursor, here's what I usually do. Often the 2nd cursor will have a where clause using variables from the 1st cursor, so you need to initialize those variables before the Declares
DROP CURSOR c1DROP CURSOR c2DECLARE c1 CURSOR FOR SELECT columns FROM table WHERE... DECLARE c2 CURSOR FOR SELECT columns FROM table WHERE... OPEN c1 WHILE 1 = 1 THEN FETCH c1 INTOvars IF SQLCODE = 100THEN BREAK ENDIF *( do stuff with1st table) OPEN c2 RESET WHILE 1 = 1 THEN FETCH c2 INTO vars IF SQLCODE =100 THEN BREAK ENDIF *(do stuff with 2nd table) ENDWHILE ENDWHILEDROP CURSOR c1DROP CURSOR C2 Karen -----Original Message----- From: 'Jim Belisle' via RBASE-L <[email protected]> To: [email protected] <[email protected]> Sent: Mon, Dec 14, 2020 4:13 pm Subject: [RBASE-L] - proper code <!--#yiv4664570369 _filtered {} _filtered {}#yiv4664570369 #yiv4664570369 p.yiv4664570369MsoNormal, #yiv4664570369 li.yiv4664570369MsoNormal, #yiv4664570369 div.yiv4664570369MsoNormal {margin:0in;margin-bottom:.0001pt;font-size:11.0pt;font-family:"Calibri", sans-serif;}#yiv4664570369 span.yiv4664570369EmailStyle17 {font-family:"Times New Roman", serif;color:windowtext;font-weight:normal;font-style:normal;text-decoration:none none;}#yiv4664570369 .yiv4664570369MsoChpDefault {font-family:"Calibri", sans-serif;} _filtered {}#yiv4664570369 div.yiv4664570369WordSection1 {}-->Background: We ship out products that are unassembled. That means what we ship out are individual parts and assemblies we make. Problem: We want to look at a form I am creating so that any part looked at for any product on an open order, the user will be able to see if our existing inventory has that part covered. This is based upon the date we plan we ship it. Goal: I am trying to update usable inventory based upon part numbers used in a product and promised ship dates. So the code I need is code that will look at the table where this info is located, find each part, find the promised date (ascending), find the product the part belongs to, then update the needed amt to 0 (for scheduling the hours needed) if we have the parts available. The actual inventory amount will not change, but the variable used during the process will update to take the actual inv amt, subtract the amt needed to fill the next promised date for that part belonging to the product. So we want to be able to look at the form in this manner. Part product promised qty need need to make start inv amt inv left var Part A 8BLA15 01/05/2021 15 0 100 85 Part A 8BLA16 01/05/2021 15 0 70 Part A 8BLA17 01/08/2021 75 5 0 I was looking at using CURSORS to do the job but not sure if that is the most efficient way. Nor was I sure of how to set up a multiple cursor code. I think I would need a nested or maybe a double nested cursor. Any thoughts? James Belisle Making Information Systems People Friendly Since 1990 -- For group guidelines, visit http://www.rbase.com/support/usersgroup_guidelines.php --- You received this message because you are subscribed to the Google Groups "RBASE-L" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rbase-l/CY4PR0201MB339480EDA63A37780DC9E045A0C70%40CY4PR0201MB3394.namprd02.prod.outlook.com. -- For group guidelines, visit http://www.rbase.com/support/usersgroup_guidelines.php --- You received this message because you are subscribed to the Google Groups "RBASE-L" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rbase-l/424602862.749249.1608049147394%40mail.yahoo.com.

