Rbasic code to extract file data (AREV Specific)
At 13 MAR 2000 10:57:49PM Jim Dierking wrote:
I am using the following code to return a value in a symbolic field
in our supply file. The values are derived from inventory_sold field in the inventory_sales file. The inventory_sold file is btree indexed. I attempted to use a perform "select" which works fine as
a symbolic in a window, but does not work in an Rlist statement.
The code below indicates how I tried to use a btree.extract command.
When do an Rlist using the inventory_sold field it goes to the debugger, indicating the file has not been opened. I am looking for
help on a clean and quick way to extract the data. TIA for the help!
Field Code For Inventory_Sold Field in the Supply File.
ID=';QUANTITY =';TOTALAMOUNT=';ITEM='
RECNO=@ID; REC=@RECORD;ID=@ID; DIC=@DICT
OPEN 'INVENTORY_SALES' TO INVENTORY_SALES ELSE STOP 'UNABLE TO OPEN INVENTOOPEN 'DICT','INVENTORY_SALES' TO @DICT ELSE PRINT 'CANT OPEN D.INVENTORY_SASEARCH.STRING=INGREDIENT_SUPPLY_NO" : @VM : "':ID:'" : @FM
FILE=INVENTORY_SALES"
DICT.FILE=DICT.INVENTORY_SALES"
CALL BTREE.EXTRACT(SEARCH.STRING,FILE,DICT.FILE,KEYS)*PERFORM 'SELECT INVENTORY_SALES WITH INGREDIENT_SUPPLY_NO EQ "':RECNO:'" (S)'
LOOP:
READNEXT @ID ELSE GOTO DONEREAD @RECORD FROM INVENTORY_SALES,@ID ELSE GOTO DONE ;* LOOPQUANTITY=@RECORDTOTALAMOUNT=TOTALAMOUNT + QUANTITYGOTO LOOP
DONE:
@RECORD=REC
@ID=ID
@DICT=DIC
@ANS=TOTALAMOUNT
At 14 MAR 2000 01:16AM Don Bakke wrote:
Jim,
I couldn't tell from your message whether Btree.Extract also gave you problems in RList or not. However, I can tell you that your Btree.Extract statement has an error. Your code looks like this:
CALL BTREE.EXTRACT(SEARCH.STRING,FILE,DICT.FILE,KEYS)
The fourth parameter needs to be the dictionary handle and not the dictionary name itself. You should use @DICT instead as you have already opened DICT.INVENTORY_SALES to this variable.
Honestly I don't see the need to use the @variables anywhere in your code. Opening @DICT was kind of redundant since this symbolic is running in the same table. None of your commands require the @variables so it would be safer (IMHO) to leave them out of your code except as a means for saving them and restoring them just in case another process changes their values.
dbakke@srpcs.com
At 14 MAR 2000 04:48AM [url=http://www.sprezzatura.com" onMouseOver=window.status=Click here to visit our web site?';return(true)]The Sprezzatura Group[/url] wrote:
Don is of course spot on the money - although he mistyped fourth where he meant to say third.
World Leaders in all things RevSoft
At 14 MAR 2000 10:17AM Don Bakke wrote:
Nah, I mistyped "Don Bakke" when I meant to say "The Sprezzatura Group" to make you guys look bad
dbakke@srpcs.com
At 14 MAR 2000 12:31PM Jim Dierking wrote:
I fixed the dict file handle as suggested and it resolved the file
open error. However, the field subroutine itself is returning a null value. I haven't used Btree Extract for routines and I may be confused in what it can do. I am trying to use it to create a variable that has the keys of all records in the INVENTORY_SALES file for a given Suppply_No in the SUPPLIES file. Then I want to LOOP through those INVENTORY_SALES records and total the quantity. Can
BtreeExtract allow one to create such record keys, or does it only allow them to come up in a POPUP for record selection in a browse window? As I previously mentioned, I tried using a PERFORM selection to obtain the keys, but the field value does not properly display when doing an RLIST statement. Thanks again for the help, Jim.
At 14 MAR 2000 12:46PM dsig@teleport.com wrote:
Jim,
the 'keys' variable (param 4) should return a delimited list of all keys found for selection.
One thing to keep in mind is it will only return a list of lt 64K.
You can check this info out in the help file .. simply put your cursor on the word btree.extract and press f1.
dsig@teleport.com onmouseover=window.status=imagine … opinions that seem to scare;return(true)"
David Tod Sigafoos ~ SigSolutions
cell: 503-341-2983
At 14 MAR 2000 02:33PM Jim Dierking wrote:
I understand the 64k limit and the option to create multiple keys.
It doesn't appear that I am getting any values in KEYS. Did I write the Search.String variable correctly? Also, at this point the routine
results in a blue scree RList report. All I am looking for is to pass
the KEYS to the LOOP and obtain a total quantity. Thanks Again, Jim
At 14 MAR 2000 04:33PM dsig@teleport.com wrote:
Jim,
Just taking a quick look at what you posted .. can't play on a system right now BUT ..
You said
SEARCH.STRING=INGREDIENT_SUPPLY_NO" : @VM : "':ID:'" : @FM
This would mean that you are looing for data that is: ':ID:' .. don't you want to just pass the data .. like
SEARCH.STRING=INGREDIENT_SUPPLY_NO" : @VM : ID : @FM
Also .. you wrote ..
DICT.FILE=DICT.INVENTORY_SALES"
Don't you want to pass the fileVar for Dict.Inventory_Sales? Pass @Dict instead.
Also you aren't passing option or flag .. system must default these values but you never know ..
Your call was
CALL BTREE.EXTRACT(SEARCH.STRING,FILE,DICT.FILE,KEYS)
Helpfile says
CALL BTREE.EXTRACT(srch_string, table, dictvar, keys, option, flag)
If you still have trouble leave a message here and I will play with it when I get off ..
dsig@teleport.com onmouseover=window.status=imagine … opinions that seem to scare;return(true)"
David Tod Sigafoos ~ SigSolutions
cell: 503-341-2983
At 14 MAR 2000 05:49PM Jim Dierking wrote:
I have been using a Message with a variable to test whether or not I am obtaining the KEYS. When I test the SEARCH.STRING, I only get the
literal field name "INGREDIENT_SUPPLY_NO". In my test I am trying to
use ID (which is a variable set to @ID of the SUPPLY file) to obtain Keys for records in the INVENTORY_SALES file which have the same ID value in the INVENTORY_SOLD field. Can Btree.Extract obtain these keys without putting them to a Rlist report screen? Is there a suppression preference? As you can see I did change the SEARCH.STRING
as you suggested. Do I have the field problem notated? Thanks again,
Jim
Open FILE…
Open Dict..
SEARCH.STRING=INGREDIENT_SUPPLY_NO" : @VM : ID : @FM
CALL BTREE.EXTRACT(SEARCH.STRING,INVENTORY_SALES,@DICT,KEYS,option,flag)
LOOP
Read…
At 14 MAR 2000 06:15PM dsig@teleport.com wrote:
Jim,
Why don't you give me a call tonight (after 6). I would like to talk to you about your scenerio ..
Use the cell number below ..
dsig@teleport.com onmouseover=window.status=imagine … opinions that seem to scare;return(true)"
David Tod Sigafoos ~ SigSolutions
cell: 503-341-2983
At 14 MAR 2000 06:29PM [url=http://www.sprezzatura.com" onMouseOver=window.status=Click here to visit our web site?';return(true)]The Sprezzatura Group[/url] wrote:
Are you expecting btree.extract to return an active select list? It returns a delimited key list in HITS.
World Leaders in all things RevSoft
At 14 MAR 2000 09:37PM Jim Dierking wrote:
Yes, I need to make the list active so it can be processed by the READ
@RECORD statement….
then it reads the quantity field and totals the amount for all of the
matching records, and returns the total as @ANS. Can this be done
with Btree.Extract? Is there a better way to do this besides a
PERFORM or execute statement? Thanks, Jim.
At 14 MAR 2000 09:41PM [url=http://www.sprezzatura.com" onMouseOver=window.status=Click here to visit our web site?';return(true)]The Sprezzatura Group[/url] wrote:
So perhaps your loop should grab subsequent values from the HITS variable rather than READNEXTing against a non-existent select list OR call MAKE.LIST using HITS (having first ensured @Vm -] @Fm) to create an active select.
World Leaders in all things RevSoft