Quick screen auto-find

Mike Palandri palandri@4j.lane.edu
Fri, 11 Dec 1998 10:14:48 -0800


At 04:24 PM 12/11/1998 +0000, Chris Sharman wrote:
>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,

Going strictly from memory, I have written screens where a parameter
received by the screen is checked in the Initialize procedure eg:

SCREEN X RECEIVING DC-PARM

ACTIONMENU LABEL "Find"   ACTION DESIGNER FND1     MENUKEY "F" 

TEMP DC-Z	CHAR*10

FILE Y
ACCESS VIAINDEX ABC USING DC-Z

[...]
FIELD TC-Z
[...]


PROCEDURE INITIALIZE
BEGIN
	IF DC-PARM <> "specialval"
	THEN BEGIN
		LET DC-Z = DC-PARM
		PUSH FIND
	END
END

PROCEDURE DESIGNER FND1 NODATA 
BEGIN 
   ACCEPT TC-Z
   PUSH FIND    
END 


Mike