![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I am having a problem where I have created a subroutine which performs a number of selects to return a quantity, sounds simple but, in this subroutine I check SYSTEM(11) at the beginning to see if an external select list is active, if so I READLIST to put it into an array, therefore killing the select list. I then perform my necessary selects and calculate the quanties checking the params that allows for a period selection by historical months. .ie. -1, -2, -3...etc. At the end I check the array from the external select list and then FORMLIST to create an active external select list again. This subroutine works when I call it from another program and all lists are maintained as I would of expected. However, when I put my subroutine into dictionaty items for calculating say 1 months and 2 months history QUANTITY.1 001:V 002:SUBR('CALC.QUANTITY', @ID, '-1') 003: 004:Qty 005:5R 006:S QUANTITY.2 001:V 002:SUBR('CALC.QUANTITY', @ID, '-2') 003: 004:Qty 005:5R 006:S And I try to list the relevant file LIST INVENTORY QUANTITY.1 QUANTITY.2 Inventory Qty1 Qty2 XXXXX*223233 20 0 I only get correct figures for the first dictionary and zeros for the second. It is like the internal select list from the first is being used in the second dictionary?! When listed individually I get the correct figures. LIST INVENTORY QUANTITY.1 Inventory Qty1 XXXXX*223233 20 LIST INVENTORY QUANTITY.2 Inventory Qty2 XXXXX*223233 10 I think the when READLIST'ing and FORMLIST'ing the pointer is getting out of synch when performing each dictionary on after another. Can anyone help? I'm going insane!! |
#3
| |||
| |||
|
|
This is apparently not D3, so I claim no inside knowlege, but can you try calling the subroutine twice from a program as happens when the dict processing takes place? Does that work properly? Since it works as a single column but fails on two, does it work when called twice as well? If it does not fail, then there's an intrinsic difference between the basic list handler and the query language. When you are doing your other selects, is it possible you're doing an execute? On D3, an execute will kill an active select list. Instead of readnext and storing ids in an array, can you simply select your new data to specific List Variables as in select filename to myList readnext id from myList... instead of relying so heavily on the default file variable which is obviously in use at a higher level. Mark "ChrisAdams" <cad... (AT) zafire (DOT) com> wrote in message news:1170948692.803319.170060 (AT) a75g2000cwd (DOT) googlegroups.com... I am having a problem where I have created a subroutine which performs a number of selects to return a quantity, sounds simple but, in this subroutine I check SYSTEM(11) at the beginning to see if an external select list is active, if so I READLIST to put it into an array, therefore killing the select list. I then perform my necessary selects and calculate the quanties checking the params that allows for a period selection by historical months. .ie. -1, -2, -3...etc. At the end I check the array from the external select list and then FORMLIST to create an active external select list again. This subroutine works when I call it from another program and all lists are maintained as I would of expected. However, when I put my subroutine into dictionaty items for calculating say 1 months and 2 months history QUANTITY.1 001:V 002:SUBR('CALC.QUANTITY', @ID, '-1') 003: 004:Qty 005:5R 006:S QUANTITY.2 001:V 002:SUBR('CALC.QUANTITY', @ID, '-2') 003: 004:Qty 005:5R 006:S And I try to list the relevant file LIST INVENTORY QUANTITY.1 QUANTITY.2 Inventory Qty1 Qty2 XXXXX*223233 20 0 I only get correct figures for the first dictionary and zeros for the second. It is like the internal select list from the first is being used in the second dictionary?! When listed individually I get the correct figures. LIST INVENTORY QUANTITY.1 Inventory Qty1 XXXXX*223233 20 LIST INVENTORY QUANTITY.2 Inventory Qty2 XXXXX*223233 10 I think the when READLIST'ing and FORMLIST'ing the pointer is getting out of synch when performing each dictionary on after another. Can anyone help? I'm going insane!!- Hide quoted text - - Show quoted text - |
![]() |
| Thread Tools | |
| Display Modes | |
| |