FW: Quick screen auto-find
Robert J.M. Edis
Robert.Edis@creatcomp.com
Fri, 11 Dec 1998 15:07:40 -0500
G'day Chris
I think I understand your issue as this:
ScreenA calls screenB passing record key for autofind.
Menuscreen calls screenB passing nothing and user is prompted for key value.
If this is correct then you can try this:
Screen tmenu menu
Temp key1 char*1 initial ""
Title "Test Menu"
Skip 2
Subscreen a label "Primary record"
Subscreen b label "Detail records" passing key1
build
screen a
file pfile primary
access via preckey using preckey request preckey
access sequential
temp key1 char*1 initial preckey of pfile
title "TEST SCREEN A"
skip 2
FIELD PRECKEY OF PFILE REQUIRED NOCHANGE LOOKUP NOTON PFILE
FIELD RECDATA OF PFILE
FIELD FRECKEY OF PFILE
skip 2
subscreen b label "Detail Record Test Screen" id 04
procedure designer 04
begin
let key1 = freckey of pfile
run screen b passing key1 mode f
end
build
screen b receiving key1
temp key1 char*1
file dfile primary occurs 5
access via preckey using key1
access via preckey using preckey request preckey
access sequential
CLUSTER OCCURS WITH DFILE
FIELD PRECKEY OF DFILE REQUIRED NOCHANGE
FIELD RECDATA2 OF DFILE
cluster
procedure path
begin
if key1 NE ""
then let path = 1
else begin
request preckey
if promptok
then let path = 2
else let path = 3
end
end
BUILD list detail
The default FIND procedure is:
> PROCEDURE FIND
> BEGIN
> FOR MISSING DFILE
> BEGIN
> IF PATH = 1
> THEN GET DFILE VIA PRECKEY USING KEY1
> IF PATH = 2
> THEN GET DFILE VIA PRECKEY USING PRECKEY OF DFILE
> IF PATH = 3
> THEN GET DFILE SEQUENTIAL
> END
> END
I tested this sample using RMS files and it works fine.
Blue
PowerHouse consultant
Rhode Island, USA
Disclaimer:
The opinions and ideas expressed in this message are my own and have no
relationship to my current employer, Initial Technical Staffing, its client
CCI, or any of CCI's clients.
-----Original Message-----
From: Chris Sharman [SMTP:Chris.Sharman@ccagroup.co.uk]
<mailto:[SMTP:Chris.Sharman@ccagroup.co.uk]>
Sent: Friday, December 11, 1998 11:25 AM
To: powerh-l@lists.swau.edu <mailto:powerh-l@lists.swau.edu>
Cc: Chris.Sharman@ccagroup.co.uk
<mailto:Chris.Sharman@ccagroup.co.uk>
Subject: Quick screen auto-find
A fairly common requirement here is that we have a lookup screen
(various
keys), which users use to find data in the normal way; and we'd also
like to
call it from a parent screen, passing in the key/record to display
(either with
the passing mechanism or using systemvalues).
I've found no way of implementing a screen that works both ways.
I can default the access statements (or specify them to request
keys),
and that always prompts the user.
I can specify an access statement that uses passed in values, and
that
will never prompt the user.
What I need is an IF clause on the access statement, or a facility
to push
characters into the PSIB; so that I can lookup on passed in values
(if any),
otherwise find normally.
Eg
SCREEN mine
TEMP lookupby char*10 = getsystemval("LOOKUPBY")
FILE myfile PRIMARY
ACCESS VIA key1 USING lookupby IF (lookupby<>"")
ACCESS VIA key1 USING key1 REQUEST key1
ACCESS VIA key2 USING key2 REQUEST key2
etc ...
Failing that, I suppose I have to write my own PATH & FIND
procedures: a
hateful practice I prefer to avoid. Any better suggestions anyone ?
______________________________________________________________________
Chris Sharman Chris.Sharman@CCAgroup.co.uk
<mailto:Chris.Sharman@CCAgroup.co.uk>
CCA Stationery Ltd, Eastway, Fulwood, Preston, Lancashire, PR2 9WS.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= = = =
Subscribe: "subscribe powerh-l" in message body to
majordomo@lists.swau.edu <mailto:majordomo@lists.swau.edu>
Unsubscribe: "unsubscribe powerh-l" in message to
majordomo@lists.swau.edu <mailto:majordomo@lists.swau.edu>
powerh-l@lists.swau.edu <mailto:powerh-l@lists.swau.edu> is
gatewayed one-way to bit.listserv.powerh-l
This list is closed, thus to post to the list, you must be a
subscriber.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
powerh-l@lists.swau.edu is gatewayed one-way to bit.listserv.powerh-l
This list is closed, thus to post to the list, you must be a subscriber.