Creating Custom Report Headers in CAPPS

Creating Custom Report Headers in CAPPS

Custom Report Headers can only be created using DMIS commands in your program and is visible in Classic View

 

The following steps will give an example of how to create such headers using DMIS commands in CAPPS:

  • First declare string variables to create custom titles.

DECL/STRING,CUSTOM_HEADER_1,CUSTOM_HEADER_2,CUSTOM_HEADER_3,CUSTOM_VALUE_1, CUSTOM_VALUE_2,CUSTOM_VALUE_3
  • Here is an example of assigning a text for your string variable. You can enter any text between single quotation marks. Also this is where you can adjust the space in between title & column.

DATE_HEADER='DATE :'
  • OBTAIN/KEYBRD command will prompt a dialog to the operator asking to enter some information during program execution. In the example below, it tells the operator to enter date information, as it is indicated in the query text (text between quotation marks). Once the operator enters the date to the dialog, the entry will be assigned to a String variable DATE_VALUE as shown below:

DATE_VALUE=OBTAIN/KEYBRD,'ENTER DATE'
  •  String concatenation can be done using CONCAT(String1, String2, ...) command. Any number of string variables can be combined separated by commas. Note that the assignment operator "=" is used to assign combined concatenated string to COMPLETE_HEADER, which is another String variable declared above. 

DECL/STRING,COMPLETE_HEADER COMPLETE_HEADER=CONCAT(DATE_HEADER,DATE_VALUE)

Any type of operation performed on the variables requires correct type of variable. CAPPS doesn't infer, nor check the variable type during compilation/execution. Assigning or performing operations on a wrong variable type may caused empty outputs. Empty variables doesn't cause any problems during compilation/execution but it may cause wrong outputs in report

 

  • CH(1) is a special variable which represents a custom header information in CAPPS. Once all custom report headers and information is entered to are combined under a String variable COMPLETE_HEADER, we can assign it to CH(1) as shown below:

CH(1)=CUSTOM/'@COMPLETE_HEADER'
  • R(1) represents the report header in CAPPS, and whatever is assigned to it will be used to create the report header using OUTPUT command follows it. Since we assign custom header 

R(1)=REPORT/CH(1) OUTPUT/R(1)

 

Note that there is no simple way to concatenate the custom report headers created so each header should be output using OUTPUT/R(1) before moving to the next custom report header entry. An example of this is shown below.

  • The attached text file includes DMIS commands that will generate a custom report header for you. You can safely copy and paste the code to a test program, and execute it to see how it works. 

$$********************************************************** $$ FOLLOWING COMMAND CLEARS THE EXISTING REPORT AND HEADER $$********************************************************** CAPPS/REPORT,DELETE $$***************************************************************************** $$ FIRST DECLARE STRING VARIABLES TO HOLD CUSTOM HEADER AND VALUE INFORMATION $$***************************************************************************** DECL/STRING,CUSTOM_HEADER_1,CUSTOM_HEADER_2,CUSTOM_HEADER_3,CUSTOM_VALUE_1,CUSTOM_VALUE_2,CUSTOM_VALUE_3 $$******************************* $$ SPACE HOLDS A SPACE CHARACTER $$******************************* DECL/STRING,SPACE SPACE=' ' $$******************************************************************************* $$ TO CREATE A CUSTOM DATE INFORMATION DECLARE A DATE HEADER AND VALUE VARIABLE $$******************************************************************************* DECL/STRING,DATE_HEADER,DATE_VALUE $$ ASSIGN THE HEADER TITLE (IMPORTANT: USE SINGLE QOUTES FOR STRING VALUES) DATE_HEADER='DATE :' $$************************************************************************* $$ OBTAIN/KEYBOARD COMMAND IS USED TO TAKE OPERATOR INPUT DURING EXECUTION $$ REFER TO DMIS COMMANDS MANUAL UNDER HELP SECTION FOR MORE INFO $$************************************************************************* DATE_VALUE=OBTAIN/KEYBRD,'ENTER DATE' $$*********************************************************************** $$ DECLARE A NEW STRING VARIABLE WHICH WILL HOLD BOTH HEADER AND VALUE $$*********************************************************************** DECL/STRING,COMPLETE_HEADER $$********************************************************************** $$ CONCAT(STRING_1, STRING_2, ...) IS USED TO COMBINE STRING VARIABLES $$ REFER TO DMIS COMMANDS MANUAL UNDER HELP SECTION FOR MORE INFO $$ ASSIGN COMBINED STRING TO COMPLETE_HEADER $$********************************************************************** COMPLETE_HEADER=CONCAT(DATE_HEADER,DATE_VALUE) $$************************************************************************************ $$ CH(1) IS SPECIAL VARIABLE WHICH HOLDS CUSTOM REPORT HEADER INFO $$ CH(1) IS A SYSTEM VARIABLE, NAME OF THIS VARIABLE CAN NOT BE ALTERED $$ CUSTOM/'STRING' IS A COMMAND TO DEFINE A CUSTOM HEADER $$ VALUE BETWEEN '' CAN BE A CONSTANT STRING (HARD CODED) OR A VARIABLE $$ IMPORTANT: IF A STRING VARIABLE IS USED @ SIGN MUST PRECEED THE VARIABLE NAME $$************************************************************************************* CH(1)=CUSTOM/'@COMPLETE_HEADER' $$*************************************************************************** $$ R(1) IS SPECIAL SYSTEM VARIABLE THAT REPRESENTS A COMPLETE REPORT HEADER $$ NAME OF THIS VARIABLE CAN NOT BE ALTERED $$ ASSIGN CH(1) CUSTOM HEADER TO R(1) $$ OUTPUT/R(1) COMMAND WILL OUTPUT THE CUSTOM HEADER LINE CREATED ABOVE $$*************************************************************************** R(1)=REPORT/CH(1) OUTPUT/R(1) $$*************************************************************************************** $$ REST OF THE CUSTOM HEADERS AND VALUES BELOW ARE CREATED IN THE SAME MANNER $$ MAKE SURE TO OVERWRITE COMPLETE_HEADER AND CH(1) VARIABLES FOR EACH HEADER-VALUE PAIR $$ OVERWRITTEN VARIABLES NOT NEED TO BE DECLARED AGAIN $$**************************************************************************************** DECL/STRING,TIME_HEADER,TIME_VALUE TIME_HEADER='TIME :' TIME_VALUE=OBTAIN/KEYBRD,'ENTER TIME' COMPLETE_HEADER=CONCAT(TIME_HEADER,TIME_VALUE) CH(1)=CUSTOM/'@COMPLETE_HEADER' R(1)=REPORT/CH(1) OUTPUT/R(1) $$---------------------------------------------------------------- CUSTOM_HEADER_1='WORK ORDER :' CUSTOM_VALUE_1=OBTAIN/KEYBRD,'ENTER WORK ORDER' COMPLETE_HEADER=CONCAT(CUSTOM_HEADER_1,SPACE,CUSTOM_VALUE_1) CH(1)=CUSTOM/'@COMPLETE_HEADER' R(1)=REPORT/CH(1) OUTPUT/R(1) $$---------------------------------------------------------------- CUSTOM_HEADER_2='BAR CODE :' CUSTOM_VALUE_2=OBTAIN/KEYBRD,'ENTER BAR CODE' COMPLETE_HEADER=CONCAT(CUSTOM_HEADER_2,SPACE,CUSTOM_VALUE_2) CH(1)=CUSTOM/'@COMPLETE_HEADER' R(1)=REPORT/CH(1) OUTPUT/R(1) $$---------------------------------------------------------------- CUSTOM_HEADER_3='SHIPPING NUMBER :' CUSTOM_VALUE_3=OBTAIN/KEYBRD,'ENTER SHIPPING NUMBER' COMPLETE_HEADER=CONCAT(CUSTOM_HEADER_3,SPACE,CUSTOM_VALUE_3) CH(1)=CUSTOM/'@COMPLETE_HEADER' R(1)=REPORT/CH(1) OUTPUT/R(1)