| Title: | *OLD* ALL-IN-1 (tm) Support Conference |
| Notice: | Closed - See Note 4331.l to move to IOSG::ALL-IN-1 |
| Moderator: | IOSG::PYE |
| Created: | Thu Jan 30 1992 |
| Last Modified: | Tue Jan 23 1996 |
| Last Successful Update: | Fri Jun 06 1997 |
| Number of topics: | 4343 |
| Total number of notes: | 18308 |
Hi:
I have a problem : I can't use alternate key of ALL-IN-1 index to
access a particular record from a ALL-IN-1 file.
In the scrip file I wrote :
FOR forname:key2 with .key2 = "..." DO GET #A = .%KEY
but the result I traced is accessed sequentially instead of indexed,
Why? Have I done something wrong?
Is there any solution in the notesfiles?
Thanks a lot.
Kelly Chi
| T.R | Title | User | Personal Name | Date | Lines |
|---|---|---|---|---|---|
| 1641.1 | Check the FDL | AIMTEC::BUTLER_T | Wed Oct 21 1992 13:23 | 12 | |
Kelly,
Is key2 the actual name for the alternate key in the FDL? If it is
in quotes (in the fdl) you have to supply the quotes also.
for forname:"key2" with .key2 = "..." do get #a = .%key
An excellent note is 2757 in the old conference. I believe it
is in IOSG::ALL-IN-1_V23.
Tim
| |||||
| 1641.2 | 2362 short version | AIMTEC::BUTLER_T | Thu Oct 22 1992 13:00 | 20 | |
abbreviated version of note 2362:
FOR DSAB:KOR WITH .KOR = #A DO GET .%KEY
This will do a keyed search on the KOR for keys begining with #A
FOR DSAB:KOR WITH .KOR = #A AND .FIELD1 = #B
Same as above as long as #B is not null
FOR DSAB:KOR WITH .KOR = #A AND (.FIELD1 = #B OR .FIELD1 ENS #B)
This will do a keyed search regardless of whether #B is null or not
Note: the last two produce the same results. This is for the case
where select forms provide the user the ability to search on many
fields and the user does not provide input to all fields.
| |||||
| 1641.3 | 2727 short version | AIMTEC::BUTLER_T | Thu Oct 22 1992 13:22 | 44 | |
abbreviated version 2727
Background: Has a file TOTO.DAT defined by form TOTO, with the key
field TOTO_KEY.
(MY NOTE: TOTO was originally used in the note 2727, it has nothing to
do with previous replies!)
The following gives a keyed search:
FOR TOTO WITH TOTO_KEY EQS "a key value" DO something
The following gives a sequential search:
FOR TOTO WITH TOTO_KEY GTS "lower value" AND TOTO_KEY LTS "uppdr"
DO something.
2727.1
You must use BEGINNING, EQS or ENS.
Try this:
FOR FIRST TOTO WITH TOTO_KEY = "lower" DO save_the_key
Then use GET TOTO.%NEXT[saved_key]
2727.2
Question: How to do keyed access on secondary keys?
2727.3
You have to supply the secondary keys's name in the FDL file. If
it is in quotes supply the quotes.
Note: ANAL/RMS/FDL adds quotes. You should use TPU, EDT to remove
them if you do not wish to.
2727.4
A discussion on how in BEV 2.1 the quotes are not required, if you
use uppercase characters in the DSR as well as in the FDL-Editor.
| |||||
| 1641.4 | More Alternatives | AIMTEC::BUTLER_T | Thu Oct 22 1992 13:49 | 50 | |
More on this from my notebook: Jeff Nester @KXO
Background: has an indexed file with 8 keys and duplicates everywhere.
The following does a keyed search:
SELECT FOR WHOIS_MAP:UC_LNAME WITH .US_LNAME = LATS_NAME AND
.FIRST_NAME = FIRST_NAME DO DISPLAY STUFF/STYLE=CHOICE
When he adds just one more field on the search it become sequential.
SELECT FOR WHOIS_MAP:UC_LNAME WITH .US_LNAME = LATS_NAME AND
.FIRST_NAME = FIRST_NAME AND USER_ID = USER_ID
DO DISPLAY STUFF/STYLE=CHOICE
Things to check: To open a file with multiple keys you must
specify the file and FDL file in the entry form. A reminder
on using the name as it appears in the FDL for the keyed
field.
The above re_inforced previous discussions on a blank field and/or
input for a field not supplied by the user.
More explanation: If your RSE uses Boolean expressions that require
the evaluation of that field with the RSE, and you leave it blank --
espically if your RSE uses the "=" or "BEGINNING" -- ALL-IN-1 *must*
do a sequential search of the entire file. To put it another way:
it is doing a keyed search - with a blank field all records match,
thus it does a sequential search.
F
More information from Brad, SSM developement: A boolean "begining with"
does keyed access if the filed is not blank. Use an argument form to
get all the fields then build your FOR.
An alternative is to use something like this:
get #op = "="
.IF arg_field2 ENS "" THEN GET #op = "ENS"
GET OA$FUNCTION = 'FOR dsr:kor WITH .kor = arg_field1 AND -
.dsr_field2 ' #op ' arg_field2 DO mumble'
| |||||