Grouping Business Logic In a Business View

How to:

Reference:

A Business View is stored as if it were a real Master File. However, it has no SUFFIX attribute. Instead, it contains a VIEW_OF attribute that points to its underlying Master File. When the Business View is used in a request, all of the actual field and security information comes from the original Master File. If the field is from a cross-referenced segment in the original Master File, all of the cross-reference segment and key information remains in the original Master File.

The Business View can be assigned to a different application from the original Master File, providing security and application integrity in the form of APP PATH restrictions on different Business Views.

A Business View is organized into pseudo segments called folders. Each folder can contain a group of fields and/or other folders. A folder can also be empty. The fields in a folder can come from different segments in the original Master File. If the fields do not lie along a single path in the original Master File and your request includes fields from separate paths in the original Master File, warning messages may be generated when you run the request.

A Business View can include real fields, calculated values (COMPUTEs), virtual fields (DEFINEs), and filters from the original Master File.

Business views are most useful as views of relational and FOCUS data sources. They are not recommended against cube data sources, as they eliminate drill down capabilities.

The field and segment names in a Business View can be the same as the names in the original Master File, or you can assign new field names in the Business View. When you run a request against a Business View in which any name does not match the corresponding name in the original Master File, the request goes through a transformation process to substitute the real name. To enable this name translation process, the SET FOCTRANSFORM=ON command must be in effect before issuing a TABLE, DEFINE, or JOIN command when any name in the Business View is different from the real field name.


Top of page

x
Syntax: How to Enable Name Translation for Business Views
SET FOCTRANSFORM={ON|OFF}

where:

ON

Converts all the field and segment references to the corresponding entities in the real Master File. ON is the default value.

OFF

Does not convert field and segment references.


Top of page

x
Syntax: How to Define a Business View
FILE = bv_name, VIEW_OF=real_mf 
    [, REMARKS|DESC="default_desc" 
    [, DESC_ln="desc_for_ln" ...]] $ 
 SEGMENT = folder_name , [PARENT=parent_folder_name  
     [, DESC = "default_desc", 
     [DESC_ln="desc_for_ln" ...]]] $ 
   [FIELD = bv_field_name, [ALIAS=real_field_name] , 
     [BELONGS_TO_SEGMENT= real_segment_name]  ,  
     [, TITLE = "default_title" 
     [, TITLE_ln="title_for_ln" ...]]]
     [, DESC="default_desc" 
     [, DESC_ln="desc_for_ln" ...], $]]
   [FIELD ...   ]
 [SEGMENT ...     ]

where:

bv_name

Is the name you give to the view.

real_mf

Is the name of the original Master File.

folder_name

Is the name of a virtual segment in the view. A folder is allowed to be empty.

parent_folder_name

Is the name of the parent of the virtual segment.

bv_field_name

Is the field name you assign. It can be the same as the real field name or a different field name. If it is different, the real field is identified by the ALIAS attribute.

real_field_name

Is the name of the field in the original Master File. This field can be a real field, a virtual field, or a calculated value. If bv_field_name matches real_field_name, the ALIAS attribute can be omitted. If no ALIAS is specified, the Business View field name must match the field name in the original Master File.

real_segment_name

Is the name of the segment in which the field resides in the original Master File. If the real field name is unique in the original Master File, the BELONGS_TO_SEGMENT attribute can be omitted. If BELONGS_TO_SEGMENT is missing and the field name is not unique in the original Master File, the first field with a matching field name in the original Master File is used.

default_title

Is the column title to use when the LANG parameter is set to the default language for the server, or another language is set but the Master File has no corresponding TITLE_ln attribute for that field. This title is also used if the ln value is invalid.

default_desc

Is descriptive text to use when the LANG parameter is set to the default language for the server, or another language is set but the Master File has no corresponding DESC_ln attribute for that field. This description is also used if the ln value is invalid. This description displays in the front-end user interface.

ln

Specifies the language for which the title or description applies. Valid values for ln are the two-letter ISO 639 language code abbreviations.

title_for_ln

Is the title to use when the LANG parameter is set to a non-default language for the server, and the Master File has a corresponding TITLE_ln attribute, where ln is the two-digit code for the language specified by the LANG parameter.

desc_for_ln

Is the description to use when the LANG parameter is set to a non-default language for the server, and the Master File has a corresponding DESC_ln attribute, where ln is the two-digit code for the language specified by the LANG parameter.


Top of page

x
Reference: Languages and Language Codes

Language Name

Two-Letter Language Code

Three-Letter Language Abbreviation

Arabic

ar

ARB

Baltic

lt

BAL

Chinese - Simplified GB

zh

PRC

Chinese - Traditional Big-5

tw

ROC

Czech

cs

CZE

Danish

da

DAN

Dutch

nl

DUT

English - American

en

AME or ENG

English - UK

uk

UKE

Finnish

fi

FIN

French - Canadian

fc

FRE

French - Standard

fr

FRE

German - Austrian

at

GER

German - Standard

de

GER

Greek

el

GRE

Hebrew

iw

HEW

Italian

it

ITA

Japanese - Shift-JIS(cp942) on ascii cp939 on EBCDIC

ja

JPN

Japanese - EUC(cp10942) on ascii (UNIX)

je

JPE

Korean

ko

KOR

Norwegian

no

NOR

Polish

pl

POL

Portuguese - Brazilian

br

POR

Portuguese - Portugal

pt

POR

Russian

ru

RUS

Spanish

es

SPA

Swedish

sv

SWE

Thai

th

THA

Turkish

tr

TUR



x
Reference: Usage Notes for Business Views


Example: Creating a Business View

The following Business View of the EMPLOYEE data source consists of three folders:

Note that a field named JOBCODE exists in folders 2 and 3. The BELONGS_TO_SEGMENT attribute distinguishes between the JOBCODE field from the PAYINFO segment and the JOBCODE field from the JOBSEG segment in the EMPLOYEE Master File.

The following table shows the Master File for the Business View and the associated segments from the EMPLOYEE Master File:

Business View

EMPLOYEE Master File

FILENAME=EMPLOYEE_BV01, 
VIEW_OF=baseapp/employeeEMPLOYEE, $
FILENAME=EMPLOYEE, SUFFIX=FOC
SEGMENT=FOLDER1, $
 
FIELDNAME=EMP_ID, ALIAS=EMP_ID,
  BELONGS_TO_SEGMENT=EMPINFO, $
 
FIELDNAME=LAST_NAME, ALIAS=LAST_NAME,
  BELONGS_TO_SEGMENT=EMPINFO, $
 
FIELDNAME=FIRST_NAME,
  ALIAS=FIRST_NAME,
  BELONGS_TO_SEGMENT=EMPINFO, $
 
 
 
FIELDNAME=DEPARTMENT, 
ALIAS=DEPARTMENT,
  BELONGS_TO_SEGMENT=EMPINFO, $
 
FIELDNAME=CURR_SAL, ALIAS=CURR_SAL,
  BELONGS_TO_SEGMENT=EMPINFO, $
 
FIELDNAME=CURR_JOBCODE,
  ALIAS=CURR_JOBCODE,
  BELONGS_TO_SEGMENT=EMPINFO, $
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,$

Segment not included in Business view.

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,$
SEGMENT=FOLDER3, PARENT=FOLDER1, $
 
 
FIELDNAME=DAT_INC, ALIAS=DAT_INC,
  BELONGS_TO_SEGMENT=PAYINFO, $
 
FIELDNAME=PCT_INC, ALIAS=PCT_INC,
  BELONGS_TO_SEGMENT=PAYINFO, $
 
FIELDNAME=SALARY, ALIAS=SALARY,
  BELONGS_TO_SEGMENT=PAYINFO, $
 
FIELDNAME=JOBCODE, ALIAS=JOBCODE,
  BELONGS_TO_SEGMENT=PAYINFO, $
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,$

Segment not included in Business view.

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,$

Segment not included in Business view.

SEGNAME=SALINFO, SEGTYPE=SH1,
  PARENT=EMPINFO
FIELDNAME=PAY_DATE,  ALIAS=PD,
  FORMAT=I6YMD,$
FIELDNAME=GROSS, ALIAS=MO_PAY,
  FORMAT=D12.2M,$

Segment not included in Business view.

SEGNAME=DEDUCT, SEGTYPE=S1,
  PARENT=SALINFO
FIELDNAME=DED_CODE,  ALIAS=DC,
  FORMAT=A4,$
FIELDNAME=DED_AMT,  ALIAS=DA,
  FORMAT=D12.2M,$
SEGMENT=FOLDER2, PARENT=FOLDER1, $
 
 
 
FIELDNAME=JOBCODE, ALIAS=JOBCODE,
  BELONGS_TO_SEGMENT=JOBSEG, $
 
FIELDNAME=JOB_DESC, ALIAS=JOB_DESC,
  BELONGS_TO_SEGMENT=JOBSEG, $
SEGNAME=JOBSEG, SEGTYPE=KU,
  PARENT=PAYINFO,
  CRFILE=JOBFILE,
  CRKEY=JOBCODE,$

Segment not included in Business view.

SEGNAME=SECSEG,
  SEGTYPE=KLU,PARENT=JOBSEG,
  CRFILE=JOBFILE,$

Segment not included in Business view.

SEGNAME=SKILLSEG,SEGTYPE=KL,
  PARENT=JOBSEG,
  CRFILE=JOBFILE,$

Segment not included in Business view.

SEGNAME=ATTNDSEG,SEGTYPE=KM,
  PARENT=EMPINFO, 
  CRFILE=EDUCFILE,
  CRKEY=EMP_ID,$

Segment not included in Business view.

SEGNAME=COURSEG, SEGTYPE=KLU,
  PARENT=ATTNDSEG,
  CRFILE=EDUCFILE,$

The following procedure references the Business View. Note that the SET FOCTRANSFORM=ON setting is in effect by default and is needed in order to translate the qualified name FOLDER3.JOBCODE to its name in the original Master File (PAYINFO.JOBCODE):

TABLE FILE EMPLOYEE_BV01
PRINT FOLDER3.JOBCODE JOB_DESC
BY LAST_NAME BY FIRST_NAME
BY HIGHEST 1 DAT_INC  NOPRINT
END

The output is:

LAST_NAME        FIRST_NAME  JOBCODE  JOB_DESC
---------        ----------  -------  --------
BANNING          JOHN        A17      DEPARTMENT MANAGER
BLACKWOOD        ROSEMARIE   B04      SYSTEMS ANALYST
CROSS            BARBARA     A17      DEPARTMENT MANAGER
GREENSPAN        MARY        A07      SECRETARY
IRVING           JOAN        A15      ASSIST.MANAGER
JONES            DIANE       B03      PROGRAMMER ANALYST
MCCOY            JOHN        B02      PROGRAMMER
MCKNIGHT         ROGER       B02      PROGRAMMER
ROMANS           ANTHONY     B04      SYSTEMS ANALYST
SMITH            MARY        B14      FILE QUALITY
                 RICHARD     A01      PRODUCTION CLERK
STEVENS          ALFRED      A07      SECRETARY

Next, add a filter to the EMPLOYEE Master File, and include it in FOLDER1 of the Business View.

In the EMPLOYEE Master File:

FILTER DFILTER  WITH EMPINFO.EMP_ID=DEPARTMENT EQ 'MIS'; $

In the Business View:

FIELDNAME=DFILTER, ALIAS=DFILTER, BELONGS_TO_SEGMENT=EMPINFO, $

The following request implements the filter:

TABLE FILE EMPLOYEE_BV01
PRINT PAYINFO.JOBCODE JOB_DESC
BY LAST_NAME BY FIRST_NAME
BY HIGHEST 1 DAT_INC  NOPRINT
WHERE DFILTER
END

The output is:

LAST_NAME        FIRST_NAME  JOBCODE  JOB_DESC
---------        ----------  -------  --------
BLACKWOOD        ROSEMARIE   B04      SYSTEMS ANALYST
CROSS            BARBARA     A17      DEPARTMENT MANAGER
GREENSPAN        MARY        A07      SECRETARY
JONES            DIANE       B03      PROGRAMMER ANALYST
MCCOY            JOHN        B02      PROGRAMMER
SMITH            MARY        B14      FILE QUALITY


WebFOCUS