Identifying Data for Use in Reports

The data you use to create a report is organized into units called fields. Fields are stored in a data source. Each field has a value. For instance, a field named LAST_NAME stores the last name of an employee. LAST_NAME is the field, but each of the last names stored is a field value.

Fields are distinguished based on their functions in a request. Fields that are used for sorting and categorizing data are called dimensions. They are usually, but not always, alphanumeric fields. Fields that are used in summations and other calculations are called measures. They are usually numeric fields. Some numeric fields are not meant to be summed and are, therefore, not considered measures. For example a bank code would be considered a dimension because it would probably be used for sorting and selecting records.

A Master File describes the structure and contents of a data source. The Master File consists of statements, called declarations, that name each part of the file and describe its characteristics.

The following is the EMPLOYEE Master File for your reference.

FILENAME=EMPLOYEE, SUFFIX=FOC
 SEGNAME=EMPINFO,  SEGTYPE=S1
  FIELDNAME=EMP_ID,        ALIAS=EID,    FORMAT=A9,           $
  FIELDNAME=LAST_NAME,     ALIAS=LN,     FORMAT=A15,          $
  FIELDNAME=FIRST_NAME,    ALIAS=FN,     FORMAT=A10,          $
  FIELDNAME=HIRE_DATE,     ALIAS=HDT,    FORMAT=I6YMD,        $
  FIELDNAME=DEPARTMENT,    ALIAS=DPT,    FORMAT=A10,          $
  FIELDNAME=CURR_SAL,      ALIAS=CSAL,   FORMAT=D12.2M,       $
  FIELDNAME=CURR_JOBCODE,  ALIAS=CJC,    FORMAT=A3,           $
  FIELDNAME=ED_HRS,        ALIAS=OJT,    FORMAT=F6.2,         $
 SEGNAME=FUNDTRAN,  SEGTYPE=U,   PARENT=EMPINFO
  FIELDNAME=BANK_NAME,     ALIAS=BN,     FORMAT=A20,          $
  FIELDNAME=BANK_CODE,     ALIAS=BC,     FORMAT=I6S,          $
  FIELDNAME=BANK_ACCT,     ALIAS=BA,     FORMAT=I9S,          $
  FIELDNAME=EFFECT_DATE,   ALIAS=EDATE,  FORMAT=I6YMD,        $
 SEGNAME=PAYINFO,   SEGTYPE=SH1, PARENT=EMPINFO
  FIELDNAME=DAT_INC,       ALIAS=DI,     FORMAT=I6YMD,        $
  FIELDNAME=PCT_INC,       ALIAS=PI,     FORMAT=F6.2,         $
  FIELDNAME=SALARY,        ALIAS=SAL,    FORMAT=D12.2M,       $
  FIELDNAME=JOBCODE,       ALIAS=JBC,    FORMAT=A3,           $
 SEGNAME=ADDRESS,   SEGTYPE=S1,  PARENT=EMPINFO
  FIELDNAME=TYPE,          ALIAS=AT,     FORMAT=A4,           $
  FIELDNAME=ADDRESS_LN1,   ALIAS=LN1,    FORMAT=A20,          $
  FIELDNAME=ADDRESS_LN2,   ALIAS=LN2,    FORMAT=A20,          $
  FIELDNAME=ADDRESS_LN3,   ALIAS=LN3,    FORMAT=A20,          $
  FIELDNAME=ACCTNUMBER,    ALIAS=ANO,    FORMAT=I9L,          $
 SEGNAME=SALINFO,   SEGTYPE=SH1, PARENT=EMPINFO
  FIELDNAME=PAY_DATE,      ALIAS=PD,     FORMAT=I6YMD,        $
  FIELDNAME=GROSS,         ALIAS=MO_PAY, FORMAT=D12.2M,       $
 SEGNAME=DEDUCT,    SEGTYPE=S1,  PARENT=SALINFO
  FIELDNAME=DED_CODE,      ALIAS=DC,     FORMAT=A4,           $
  FIELDNAME=DED_AMT,       ALIAS=DA,     FORMAT=D12.2M,       $
 SEGNAME=JOBSEG,    SEGTYPE=KU,  PARENT=PAYINFO, CRFILE=JOBFILE, 
  CRKEY=JOBCODE,$
 SEGNAME=SECSEG,    SEGTYPE=KLU, PARENT=JOBSEG,   CRFILE=JOBFILE, $
 SEGNAME=SKILLSEG,  SEGTYPE=KL,  PARENT=JOBSEG,   CRFILE=JOBFILE, $
 SEGNAME=ATTNDSEG,  SEGTYPE=KM,  PARENT=EMPINFO,  CRFILE=EDUCFILE,
  CRKEY=EMP_ID,$
 SEGNAME=COURSEG,   SEGTYPE=KLU, PARENT=ATTNDSEG, CRFILE=EDUCFILE,$

In order to retrieve field values for use in a report, you first identify the data source in which they are stored. You identify and access a data source using the command:

TABLE FILE

followed by the name of the data source that contains the fields you want to use. The word TABLE indicates that you want to write a report request and invokes the reporting language.

For example, in this Primer, you will use the sample EMPLOYEE data source supplied with every release of the product. The reports you produce may differ from the ones you see in this Primer. Although the data source names are the same, different releases of the product may include different sets of data.

To start a request and access the EMPLOYEE data source, issue the command:

TABLE FILE EMPLOYEE

The EMPLOYEE data source contains information about employees, such as names, addresses, salary, and deductions. This information is useful for creating reports on individuals or groups of employees. You start with simple requests that display employee identification numbers, names, and salaries. You gradually include more commands in your requests to produce more complex reports.

Note: TABLEF is a variation of the TABLE command that provides a fast method of retrieving data that is already stored in the order required for printing and requires no additional sorting. Using TABLEF, records are retrieved in the logical sequence from the data source. TABLEF is limited in functionality in comparison to TABLE.

Now that you have issued the TABLE FILE EMPLOYEE command, you include instructions that retrieve information for inclusion in reports. Before you begin, you might want to display a list of fields stored in the EMPLOYEE data source.

Issue the following commands from a text editor:

?F
END

Depending on your platform, the list of fields may include asterisks, instead of blanks, to separate different groups of related fields.

FILENAME=EMPLOYEE
 EMPINFO.EMP_ID              LAST_NAME     FIRST_NAME    HIRE_DATE
 DEPARTMENT    CURR_SAL      CURR_JOBCODE  ED_HRS
 BANK_NAME     BANK_CODE     BANK_ACCT     EFFECT_DATE
 DAT_INC       PCT_INC       SALARY        PAYINFO.JOBCODE
 TYPE          ADDRESS_LN1   ADDRESS_LN2   ADDRESS_LN3   ACCTNUMBER
 PAY_DATE      GROSS
 DED_CODE      DED_AMT
 JOBSEG.JOBCODE              JOB_DESC
 SEC_CLEAR
 SKILLS        SKILL_DESC
 DATE_ATTEND   ATTNDSEG.EMP_ID
 COURSE_CODE   COURSE_NAME

Note: All references to field name in this manual assume that field names are unique within the data source structure. If field names are NOT unique, field names can be qualified as follows:

FILENAME.fieldname
SEGNAME.fieldname
FILENAME.SEGNAME.fieldname

In the above field list, the EMP_ID and JOBCODE fields are qualified to indicate which field name instance is being referenced.

WebFOCUS

Feedback