return to PRS Technologies website
Elite custom report notes
|
The following information discusses the table layouts and 4GL changes necessary
for implementing Custom Windows Reports (cusrep.exe).
Implementation
The following are necessary 4GL changes for implementing windows custom report program (cusrep.exe):
Part I
The changes below to the eiselbs server will allow the server to start
your report after the RUN button is pressed in cusrep.exe.
Note that you can test your custom report before making these changes.
In cusrep.exe, use the STORE button to create repflt records but use
the "update report settings only" radio button. Then use the
RUN button, which will actually store the report in the repdflt table.
You can then check the repdflt records through the table report or
dbaccess, and you can run your report from the command line
(eg custom.4ge testreport). It is strongly recommended that the repdflt
records are checked vs repdflt records generated from running your report
interactively in UNIX.
1. elbslib.4gl, around line 1499 (with other WHEN statements starting with "C")
WHEN "CUSTOM"
CALL elbslib_rep("custom.4ge","F") RETURNING out1
2. elbslib1.4gl, around line 1208 (at beginning of FUNCTION elbslib_rep).
Note that the "LET dummy =" lines were already there before.
IF xreport2="F" THEN
SELECT gen02,gen01 INTO xrep1,xreport FROM win_cust
WHERE reportid=back_var[9] and rectype=1
IF STATUS=NOTFOUND THEN
LET xdisplay = "Unknown custom report: ",back_var[9] CLIPPED
LET out1="Failed"
RETURN out1
ELSE
LET xreport1=xrep1 CLIPPED,".4ge"
END IF
END IF
LET dummy = xreport1 CLIPPED," ",back_var[3] CLIPPED," ",back_var[4] CLIPPED,
" ",op_name CLIPPED," ",back_var[2] CLIPPED,
" ",x_reportdir CLIPPED," ",login_nm CLIPPED," ",back_var[5]
IF xreport2 = "F" THEN
LET dummy = dummy CLIPPED," '",xreport CLIPPED,"'"
END IF
3. Create the elbslib.a library by running elbslib.link.
4. Rebuild the eiselbs server by running eiselbs.link
5. Copy eiselbs to the elbs.prog directory and restart the eiselbs server.
_____________________________________________________________________________________________________
Part II
Some changes need to be made to your main programs to update the winoutstat
table so that your custom reports will be shown by the process monitor
(psmonitor.exe). A sample main program is shown below. The comments
"NEW CODE" should be the new code which you can copy into your existing
programs.
If these changes are not made, your custom report will still run but
the process monitor will not display them and the repdflt records will
not be deleted.
#This is the Main program for custom reports
# Revisions:
# 4/8/97 EL
DATABASE son_db
GLOBALS
DEFINE op_initial CHAR(5),
xname CHAR(20),
op_level SMALLINT,
informixver CHAR(5),
print_option CHAR(1),
p_cntlrec RECORD LIKE cntlrec.*,
p_repdflt RECORD LIKE repdflt.*,
iback SMALLINT,
ar_back ARRAY[20] OF CHAR(80),
#NEW CODE
p_winoutstat RECORD LIKE winoutstat.*,
x_reportdir CHAR(256),
login_nm CHAR(20),
x_pid INTEGER,
iwaiting SMALLINT,
iwinoutstat INTEGER
#END NEW CODE
END GLOBALS
MAIN
DEFINE isort,loop CHAR(1),
p_tab1 RECORD LIKE tab1.*,
#NEW CODE
xreport LIKE winoutstat.woreport,
user_nm LIKE uaccess.uname,
xdisplay CHAR(512),
xwoindex INTEGER,
i INTEGER
#END NEW CODE
DEFER INTERRUPT
CALL check_log()
#Error logging file
CALL startlog("errlog")
#Set up the matter/timekeeper/client masks
CALL setup_mask()
LET iback = num_args()
IF iback IS NULL THEN
LET iback = 0
END IF
IF iback>0 THEN
FOR i=1 TO iback
LET ar_back[i] = arg_val(i)
DISPLAY "Report: ",ar_back[i]
END FOR
###NEW CODE
IF ar_back[7]="Y" THEN
LET iwaiting = 1
LET xdisplay = "Running this report with WAITING"
CALL debug_display(xdisplay)
LET p_winoutstat.woindex = -1
ELSE
LET iwaiting=0
END IF
###END NEW CODE
SELECT * INTO p_repdflt.* FROM repdflt WHERE repname=ar_back[1] AND repline=1
IF status=NOTFOUND THEN
DISPLAY "ERROR. Report name ",ar_back[1] CLIPPED," is not in the database."
EXIT PROGRAM
END IF
IF p_repdflt.reptype[1,1]<>"F" THEN
DISPLAY "ERROR. Report name ",ar_back[1] CLIPPED," is type ",p_repdflt.reptype CLIPPED,". This is not a Custom Report."
EXIT PROGRAM
END IF
LET isort = p_repdflt.reptype[2] CLIPPED
###NEW CODE
IF iwaiting=0 AND iback>1 THEN
LET xreport = ar_back[8]
LET xwoindex = NULL
LET xdisplay = "Winoustat index: ",xwoindex
IF xwoindex IS NULL THEN
CALL upd_winoutstat(1,"RUNNING","Starting report","Custom Report",xreport)
ELSE
SELECT * INTO p_winoutstat.* FROM winoutstat WHERE woindex=xwoindex
IF status=NOTFOUND THEN
LET xdisplay = "No winoutstat record index ",xwoindex USING "<<<<<<<",". Exiting program."
CALL debug_display(xdisplay)
EXIT PROGRAM
END IF
LET p_winoutstat.wopid = x_pid
LET p_winoutstat.wofile = p_repdflt.repdesc[1,40] CLIPPED
CALL upd_winoutstat(3,"RUNNING","Starting report","matters/clients",xreport)
END IF
LET user_nm = ar_back[3]
LET x_reportdir = arg_val(5)
LET login_nm = arg_val(6)
END IF
###END CODE
END IF
SET LOCK MODE TO WAIT
IF iback=0 THEN
OPEN FORM cus_menu FROM "custom"
OPEN FORM ctl_help FROM "ring_men"
OPTIONS HELP FILE "son_hlp.ex"
END IF
LET print_option = "s"
SELECT * INTO p_tab1.*
FROM tab1
WHERE findx MATCHES "1"
IF status = NOTFOUND OR p_tab1.cuname MATCHES "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
OR p_tab1.sn MATCHES "XXXXXXXXXX" THEN
DISPLAY "YOUR DATABASE IS NOT CORRECTLY SETUP"
AT 10, 20 ATTRIBUTE (REVERSE)
DISPLAY "CALL YOUR CUSTOMER SUPPORT REPRESENTATIVE"
AT 11, 20 ATTRIBUTE (REVERSE)
SLEEP 5
EXIT PROGRAM 1
END IF
#Make the accept key F6 instead of escape -- vect2 is set in setup2.4ge
IF p_tab1.vect2>0 THEN
OPTIONS ACCEPT KEY F6
END IF
#Initialize operator name and sort level to NULL
LET op_initial = NULL
CALL set_op()
#Set up the Menu item labels
CALL op_chk(0)
#Load the control record for use in the reports
SELECT * INTO p_cntlrec.* FROM cntlrec WHERE 1=1
LET loop = "c"
IF iback=0 THEN
CLEAR SCREEN
END IF
WHILE TRUE
LET p_repdflt.repname = NULL
LET p_repdflt.reptype = NULL
IF iback = 0 THEN
CLEAR SCREEN
DISPLAY FORM cus_menu
LET isort = NULL
INPUT isort WITHOUT DEFAULTS FROM isort HELP 6110
END IF
IF int_flag <> 0 OR isort IS NULL THEN
EXIT WHILE
END IF
CASE (isort)
WHEN "A"
CALL sample1()
END CASE
IF iback > 0 THEN
EXIT WHILE
END IF
END WHILE
IF iback=0 THEN
CLEAR SCREEN
END IF
#NEW CODE
IF iback>1 THEN
IF ar_back[2]="N" THEN
CALL debug_display("Deleting repdflt records.")
DELETE FROM repdflt WHERE repname=ar_back[1]
END IF
LET iwinoutstat = NULL
IF iwaiting=0 THEN
CALL upd_winoutstat(3,"COMPLETE","Report completed",
"Custom Report"," ")
END IF
END IF
#END NEW CODE
EXIT PROGRAM 0
END MAIN
_____________________________________________________________________________________________________
Win_Cust Table Overview
Columns
Name Description Type Size Nulls
report_id unique report identifier char 20 yes
rectype determines type of record integer yes
recseq sequential order items will appear integer yes
backnum the back var number integer yes
gen01 general data information char 80 yes
... ... char 80 yes
gen19 general data information char 80 yes
gen20 general data information char 256 yes
Table Index
Name Description Fields
i_wincust1 unique, non-clustered 3
Fields: reportid, Ascending
rectype, Ascending
recseq, Ascending
_____________________________________________________________________________________________________
Win_Cust Table Detail
Column Name
reportid The unique identifier for a set of custom report records.
recseq The numeric sequence data items (rectype 4 only) will appeear in the grid.
backnum The back-var number that will be passed to the back-end program (rectype 4 only).
rectype Determines what information gen1 to gen20 will contain. See below.
gen1 to gen20 General purpose fields, use based on rectype. See below.
Record type General purpose fields
1 Main report information
gen01 Menu description
gen02 4ge program to run
gen03 Internal repdflt.reptype name for the report
gen04 Active/Inactive (A = display on report menu, I = do not display)
gen05 Security setting ( an expression from uacess or a usmaster setting , urept1>50)
gen06 Menu Sort Order - Reports will be sorted by gen06, gen01
2 Options Record
gen01 Sort type (T=Timekeep sort, M=Matter sort)
gen02 QBE type (T=Timekeep, M=Matter, MH=Matter Historical, TH=Timekeep Historical). Pipe multiple requests together.
gen03 Allow multi-currency (Y,N)
gen04 Allow data warehousing (Y,N) - Not Implemented
gen05 Allow alternate numeric formats (Y,N)
gen06 Date options (DD=Date Range,PP=Period Range,DDPP=Dates or Periods) - Optional
gen07 Column width of report - Optional
gen08 Query name from Query Builder for custom QBE - will overide gen02 setting
gen09 Determine how qbe is passed to repdflt, 1=Send gen20, 2=pipe delimeted parts
gen20 Qbe to be passed to repdflt
3 Back_Var Information
gen01 Number of back_vars for report
gen02 Back_var assigned to start date*
gen03 Back_var assigned to end date*
gen04 Back_var assigned to other date 1*
gen05 Back_var assigned to other date 2*
gen06 Back_var assigned to start period*
gen07 Back_var assigned to end period*
gen08 Back_var assigned to other period 1*
gen09 Back_var assigned to other period 2*
* These setting are optional. If set, date/period validation will occur and soft dates will be passed
4 Variable Information
gen01 Type (D=Date,P=Period,C=Char,N=Numeric,Y=Yes/No,T=Text Only,L=List)
gen02 Characteristics (Length for Chars, Format for dates)
gen03 Default Value*
gen04 Required (Y/N)
gen05 Field Label
gen06 Validation Table (Must be used with validation column)
gen07 Validation Column (Must be used with validation table)
gen08 Validation Column2 (Not used)
gen09 Query Name (Used in right mouse click qbe and in validating the data value)
gen10 Min Value
gen11 Max Value
gen12 Short Validation List (Not used for validation, free text for information only)
gen13 Dependant Parent Info (the backnum followed by a "." and a delimited list of values)
User entry allowed for this variable if the parent backnum is one of the values in the list
gen14 Short help displayed in the status bar
gen20 A delimited list of values for gen01 type L(List) Use code.description,code.description etc.
Dropdown list will default to first item.
* The Default Value entered for the user is dependant on the gen01 Type. Refer to the following table:
Keyword Data Type Description
TODAY D System date
TODAY P Billing period in which the system date falls
CURR D If the system date falls within the current period, use period.peendt.
Otherwise use the system date
CURR P Current period taken from control default
BEGYR D First day of the year of the system date
BEGYR P Period that contains the first day of the year of the system date
BEGYRF D Period begin date of the start of the fiscal year period (cntlrec.crfiscal)
BEGRYF P Fiscal begin period (cntlrec.crfiscal)
################################################################################