T.R | Title | User | Personal Name | Date | Lines |
---|
4025.1 | Tutorial in the A1 Prog. GUIDE is good practice | GANTRY::HULL | Digital Consulting [Delivery]/Motown | Thu Mar 24 1994 20:01 | 45 |
| > <&BOLD>REQUESTOR:<&CLEAR><&TAB 02><REQUESTOR> <->
> <&TAB 10><&BOLD>EMPLOYEE NUMBER:<&CLEAR><EMP_NUMBER>
> when i try to do:
> <MERGE GREG1.BLP,GREG.LIS,[ALLIN1]GREG.DAT
you don't use the datafile here ---^, it's referenced in the BLP; see
below. Merge should just read <MERGE GREG1.BLP, GREG.LIS
> the GREG.LIS file is created but all it contains is:
> REQUESTOR: EMPLOYEE NUMBER:
Ann - you aren't specifying enough info for the BLP to retrieve the data.
The template file (.BLP) needs to be able to resolve the full Data Set
Reference (DSR) when it does the merge.
So, using your example, you need:
<&BOLD>REQUESTOR:<&CLEAR><&TAB 02><GREG1.REQUESTOR["key value"]> <->
<&TAB 10><&BOLD>EMPLOYEE NUMBER:<&CLEAR><GREG1.EMP_NUMBER["key value"]>
your entry form, GREG1, is the Data set. GREG1 has the datafile definition
in it's .FILE named data area. For just 2 fields like this, full DSR calls
are okay. For getting lots of fields in a record from 1 dataset, the
better way is to OPEN the set, get all the fields, and then CLOSE the set,
like this:
<GET GREG1.%OPEN["key value"]><->
<&BOLD>REQUESTOR:<&CLEAR><&TAB 02><.REQUESTOR> <->
notice the 'dot' in the ref's-----^
<&TAB 10><&BOLD>EMPLOYEE NUMBER:<&CLEAR><.EMP_NUMBER>
<GET .%CLOSE>
All these examples are retrieving just 1 record's info for 1 keyfield value.
There are other techniques for doing this same stuff in a loop for all
records. Look at the named data, scripts and forms used in the DIR PER
option in A1 on the Index option for the X_PRINT (Brief), etc.
Al
|
4025.2 | ok, but.... | ANGLIN::HARRISA | Touring the world for apple struedl | Fri Mar 25 1994 16:33 | 17 |
| THANKS al!!!
I've got this working for 1 record in the .DAT file. now to get it
working for multiple records. what i have is a DO script (GREG1.SCP)
FOR GREG1 WITH .REQUESTOR NES "" DO -
GET #KEY = .REQUESTOR do -
\\GET OA$FUNCTION = " MERGE " 'GREG1.BLP, GREG1.LIS'
this will create a .LIS file for each entry in GREG.DAT. what i want is
1 GREG1.LIS for the ENTIRE .DAT file.
thanks in advance for any help...
Ann
|
4025.3 | | ANGLIN::HARRISA | Touring the world for apple struedl | Fri Mar 25 1994 16:48 | 10 |
| i think i figured it out....
if i user a .BLP with :
<&oa for greg1 with .requestor nes "" <->
do merge_line <.requestor:30> <.emp_number>>
i get what i want! if anyone has a better way....
ann
|
4025.4 | Following A1 standard code in DIR PER | GANTRY::HULL | Digital Consulting [Delivery]/Motown | Fri Mar 25 1994 18:54 | 47 |
|
Standard templates SELECTIONLIST1.BLP and SELECTIONLIST.BLP (for 1 record or
many recs) in OA$BLP: show the (more complex) code used in the DIR PER Index
for printing.
<MERGE SELECTIONLIST,SELLIST.SEL just takes your selections, and creates a
flat text file of the key values, 1 key per line (SELLIST.SEL).
One of the params you can pass on the MERGE line is the list of key values to
process:
syntax: MERGE template, outfile [, keylist, headerfile]
so make a KEYLIST.BLP like this:
<for greg1 do get oa$function = "get oa$merge_line = '" .%key "'">
and run it using <MERGE KEYLIST, SELLIST.SEL
then process the real merge using the SELLIST file as the list of all keys:
<MERGE GREG1.BLP, GREG1.LIS, SELLIST.SEL, HEADERS.BLP
Put it all together in a script and off you go. As an example, here's my
generic A1 application script that feeds the list of SELected records from an
Index form to a Print action for those records. The SELLIST.SEL file is
produced in the Index's Named Data, but works just like the above example.
! APPL_PRINT_BRIEF.SCP
! This script prints a brief description of the records contained in
! the current index.
.LABEL START
!DISPLAY "Creating directory listing of selected records . . ."
GET OA$DISPLAY=OA$_DIR_CREDIRLST\force
GET #SELFILE="APPLLIST.SEL"
.IF OA$DIR:"*.*".%WHOLE[#SELFILE] == "" THEN .GOTO NO_SEL
MERGE APPLBRIEF.BLP,APPLBRIEF.LIS,APPLLIST.SEL,APPLHDRB.BLP
GET #PRINT_FILE="APPLBRIEF.LIS"
GET #PRINT_DSAB="ASCII"\DO WPPRINT
.EXIT
.LABEL NO_SEL
!DISPLAY "You must do an Index to create the selection of records to print"
GET OA$DISPLAY=OA$_DIR_NOINDAVA
|