Roles

Functions are instructional sequences of a computer program executing a certain procedure.

Their tasks can be modified and adapted to the requirements through a number of elements called parameters.

Function parameters are information defining the boundaries or actions of a routine.

By means of Role Library you can carry out the maintenance of functions to be used in the Personnel Management environment, together with the functions available in the Microsiga Protheus® environment. The functions previously registered facilitate the process for creating formulas.

To compose a formula, a function in an important tool to locate and calculate data.

Example 1:

Function FPOSREG verifies and places in a register of the table, as from the indicated key.

Function: FPOSREG('SRB',1.SRA->RA_FILIAL+SRA->RA_MAT,.F.)

Where:

SRB is the table to be researched
1 is the search order in the indicated table
SRA>RA_FILIAL+SRA>RA_MAT is the research key in the indicated table, which in this case is researching employee for branch (SRA->RA_FILIAL) and registration (SRA->RA_MAT), in table SRA (Employee Register).
.F. is the parameter indicating the type of research that is carried out, that is:
if .F. (false) indicates the first research register on the table
if .T. (true) indicates the selection of the next register with the same key

In this example, the employee dependants table being calculated is positioned. If this employee has dependants, true is returned and keeps positioned in the record. Otherwise, it returns false. To check if there are other records using the same key, call the function again, indicating .T. in the last parameter.

Function: FPOSREG('SRB',1.SRA->RA_FILIAL+SRA->RA_MAT,.T.)

Example 2:

Role Call:

Type

Result

Operator 1

1st Expression

Operator 2

2nd Expression

Operator 3

Execution

nValTot

:=

fo_SomaIncSrv(@oSRV,RC_VALOR)

 

 

.END.

Bond

 

 

!Eof()

 

 

.END.

See Also

Role Library