PeopleCode Built-in Functions and Language Constructs: B

The PeopleCode built-In functions and language constructs beginning with the letter B are listed in alphabetical order within this topic.

Syntax

BlackScholesCall(Asset_Price, Strike_Price, Interest_Rate, Years, Volatility)

Description

Use the BlackScholesCall function to return the value of a call against an equity underlying according to the Black-Scholes equations.

Parameters

Field or Control

Definition

Asset_Price

The asset price. This parameter takes a decimal value.

Strike_Price

The strike price. This parameter takes a decimal value.

Interest_Rate

The risk-free interest rate. This parameter takes a decimal value.

Years

The number of years to option expiration. This parameter takes a number value (decimal).

Volatility

The volatility of underlying. This parameter takes a decimal value.

Returns

A number representing the value of a call against an equity.

Syntax

BlackScholesPut(Asset_Price, Strike_Price, Interest_Rate, Years, Volatility)

Description

Use the BlackScholesPut function to return the value of a put against an equity underlying according to the Black-Scholes equations.

Parameters

Field or Control

Definition

Asset_Price

The asset price. This parameter takes a decimal value.

Strike_Price

The strike price. This parameter takes a decimal value.

Interest_Rate

The risk-free interest rate. This parameter takes a decimal value.

Years

The number of years to option expiration. This parameter takes a number (decimal) value.

Volatility

The volatility of underlying. This parameter takes a decimal value.

Returns

A number representing the value of a call against an equity.

Syntax

BootstrapYTMs(Date, MktInst, Accrual_Conv)

Description

Use the BootstrapYTMs function to create a zero-arbitrage implied zero-coupon curve from a yield-to-maturity curve using the integrated discount factor method, based on the Accrual_­Conv.

Parameters

Field or Control

Definition

Date

The trading date of the set of market issues. This parameter takes a date value.

MktInst

The market instrument properties. This parameter takes an array of array of number. The elements in the array specify the following:

Elements

Description

1

tenor in days

2

yield in percent

3

price per 100 par

4

coupon rate (zero for spot instruments)

5

frequency of coupon payments

6

unit of measure for coupon frequency, 0 for days, 1 for months, and 2 for years

7

coefficient a of a curve interpolating the dataset

8,9,10

coefficients b, c, and d of a curve interpolating the dataset

Returns

An array of array of number. The elements in the array have the same type as the elements in the array for the MktInst parameter.

Syntax

Break

Description

Use the Break statement to terminate execution of a loop or an Evaluate function. The program resumes execution immediately after the end of the statement. If the loop or Evaluate is nested in another statement, only the innermost statement is terminated.

Parameters

None.

Example

In the following example, Break is used to terminate the Evaluate statement, while staying within the outermost If statement:

If CURRENCY_CD = PriorEffdt(CURRENCY_CD) Then
      Evaluate ACTION
      When = "PAY" 
         If ANNUAL_RT = PriorEffdt(ANNUAL_RT) Then
            Warning MsgGet(1000, 27, "Pay Rate Change action is chosen and Pay Rate has not been changed.");
         End-if;
         Break;
      When = "DEM" 
         If ANNUAL_RT >= PriorEffdt(ANNUAL_RT) Then
            Warning MsgGet(1000, 29, "Demotion Action is chosen and Pay Rate has not been decreased.");
         End-if;
        Break;
      When-other
      End-evaluate;
      WinMessage("This message appears after executing either of the BREAK statements or after all WHEN statements are false");
End-if;

Syntax

BulkDeleteField(ProjectName, Field.FieldName [, ExclProj])

Description

Use the BulkDeleteField function to delete fields from records and pages, as well as the associated PeopleCode programs and modify the SQL either on the record, or, if the record is a subrecord, on the parent records.

Note: You must have the role Peoplesoft Administrator assigned to your UserId in order to use this function.

If you specify a project that contains objects such as fields which have an upgrade action of delete, those objects are ignored.

The field is removed from the page regardless of where the field exists on the page, whether on a grid or not.

If the field is in the SELECT clause of the SQL, the removal is straightforward. However, if the field is also used in a WHERE clause, or if the field is the only item in the SELECT clause, the record isn't modified and is instead inserted into a project called BLK_FieldName. The record should be examined and any additional changes made as necessary.

Deleting fields from records and pages does not remove the field definition itself and it does not remove the field from other areas, such as projects or message definitions.

In addition, this function does not delete the references to the field in the PeopleCode. You must manually remove the references to the deleted field. Use the Find In. . . tool to search for the field name you deleted.

Note: Because performing this operation changes records, you must subsequently rebuild the project (alter tables).

Using the Log File

Information about this operation is stored in a log field. The directory where the log file is placed depends on where the function is run from:

  • If the function is run in two-tier, the log file is located at PS_CFG_HOME /BulkOps.txt. This is also the default location if the system cannot find the other paths.

  • If the function is run from an application server, the log file is located at:

    PS_CFG_HOME /APPSERV/Domain_Name/LOGS/BulkOps.txt

  • If the function is run from an Application Engine program, the log file is written to the process' output log directory, that is:

    PS_CFG_HOME /APPSERV/prcs/Domain_Name/log_output/Process_Name_Instance/BulkOps.txt

Considerations Using this Function

This function is intended for use during configuration time only, before active runtime usage is initiated. Using this function during active runtime is not supported. Changes to data definitions are not recognized on a currently loaded component. In general, changes aren't recognized until the component is reloaded.

Bulk operations are time consuming, therefore, referencing the log file to see the progress of an operation is recommended. These operations accommodate errors and continue processing, logging the overall progress of the operation.

Warning! These operations take place in a separate transaction from the page's save status: the initiation of any of these operations immediately changes the definitions, even if the page is subsequently cancelled.

Considerations Using the Exclusion Project

If you specify ExclProj, the following items that are both in ProjectName and ExclProj are not changed, that is, the field specified is not removed from these items:

  • pages

  • records

  • associated SQL with records of type View

  • any PeopleCode associated with those items.

Individual SQL or PeopleCode items are not ignored by themselves, only as associated with records or pages.

Parameters

Field or Control

Definition

ProjectName

The name of a project that is the source of records and pages to use.

Note: When passing the project name as a parameter, if the project contains definitions with an upgrade action of delete, the system ignores those definitions.

FieldName

The name of the field to be deleted. This name must be prefixed with the reserved word Field.

ExclProj

The name of a project that has pages that should be ignored by this function.

Returns

A constant value. The values are:

Value

Description

%MDA_Success

Bulk operation completed successfully.

%MDA_Failure

Bulk operation did not complete successfully.

Example

&pjm = "MYPROJ"; 
&ret =  BulkDeleteField(&pjm, Field.OrgId, "EXCLPROJ");  
 
If (&ret = %MDA_Success) Then 
   MessageBox(0, "Metadata Fn Status", 0, 0, "BulkDeleteField succeeded"); 
Else 
MessageBox(0, "Metadata Fn Status", 0, 0, "BulkDeleteField failed"); 
End-If;

Syntax

BulkInsertField(ProjectName, Field.FieldName, ModelName, ClonePCode [, ExclProj])

Description

Use the BulkInsertField function to insert a source field into records and pages in a project if and only if the model field specified by ModelName exists on those records and pages.

If you specify a project that contains objects such as fields which have an upgrade action of delete, those objects are ignored.

Note: You must have the role Peoplesoft Administrator assigned to your UserId in order to use this function.

Using the Log File

Information about this operation is stored in a log field. The directory where the log file is placed depends on where the function is run from:

  • If the function is run in two-tier, the log file is located at PS_HOME/BulkOps.txt. This is also the default location if the system cannot find the other paths.

  • If the function is run from an application server, the log file is located here:

    PS_CFG_HOME /APPSERV/Domain_Name/LOGS/BulkOps.txt

  • If the function is run from an Application Engine program, the log file is written to the process' output log directory, that is:

    PS_CFG_HOME /APPSERV/prcs/Domain_Name/log_output/Process_Name_Instance/BulkOps.txt

Considerations Inserting Fields into Records

In records, the source field is assigned the same record field properties as the model field on each record, and is inserted directly after the model field.

If the model field has a prompt table, a prompt table is created for the source field using the name of the source field with TBL appended to it.

If the record is either a SQL View or Dynamic View type, the associated SQL is modified by having the SELECT clause expanded to include the new field.

If the record is a subrecord, the parent records of type SQL View or Dynamic View that contain this subrecord are updated.

If the SQL contains the model field in the WHERE clause, or the SQL is complex, the associated record is inserted into a project called BLK_FieldName. You should examine this record and make any necessary changes.

If the model field has PeopleCode associated with it on the record or in a component, and ClonePCode has been set to True, this PeopleCode is cloned to the new field, with all references to the model field changed to refer to the new field.

Note: Because using this function changes records that are used to build application tables, you must rebuild (alter) the specified project before these changes can be used.

Considerations Inserting Fields into Pages

If the model field is in a grid, the system inserts the new field into the grid next to the model field and assigns it the same page field properties.

If the model field is not in a grid, the system inserts the new field onto the page to the right of the model field (in the first open space) and assigns it the same page field properties. If the system detects a questionable field position, it inserts the page into a project called BLK_FieldName. The page will work as-is, however, the GUI layout may not be optimal, so you should examine these pages by hand.

The page field name property isn't cloned if it exists on the model field. Instead, the field name of the new field is used, since the page field name should be a unique identifier for page elements.

Note: If the project you specified only contained pages and not records, you do not need to rebuild the project after using this function. The changes take affect when the component containing the page is reloaded.

Considerations Using this Function

This function is intended for use during configuration time only, before active runtime usage is initiated. Using this function during active runtime is not supported. Changes to data definitions are not recognized on currently loaded component. In general, changes aren't recognized until the component is reloaded.

Bulk operations are time consuming, therefore, referencing the log file to see the progress of an operation is recommended. These operations accommodate errors and continue processing, logging the overall progress of the operation.

Warning! These operations take place in a separate transaction from the page's save status: the initiation of any of these operations immediately changes the definitions, even if the page is subsequently cancelled.

Considerations Using the Exclusion Project

If you specify ExclProj, the following items that are both in ProjectName and ExclProj are not changed, that is, the field specified is not inserted to these items:

  • pages

  • records

  • associated SQL with records of type View

  • any PeopleCode associated with those items.

Individual SQL or PeopleCode items are not ignored by themselves, only as associated with records or pages.

Parameters

Field or Control

Definition

ProjectName

The name of a project that is the source of records and pages to use.

Note: When passing the project name as a parameter, if the project contains definitions with an upgrade action of delete, the system ignores those definitions.

FieldName

The name of the field to be inserted. This name must be prefixed with the reserved word Field.

ModelName

The name of a field on which to model the inserted field. Attributes are cloned from it for records and pages, PeopleCode is modified, and SQL inserted.

ClonePCode

Specify whether to clone the PeopleCode from the model to this field. This parameter takes a Boolean value: True, clone the PeopleCode programs, False, do not.

ExclProj

The name of a project that has pages that should be ignored by this function.

Returns

A constant value. The values are:

Value

Description

%MDA_Success

Bulk operation completed successfully.

%MDA_Failure

Bulk operation did not complete successfully.

Example

&pjm = "MYPROJ"; 
 
&ret =  BulkInsertField(&pjm, Field.OrgId, Field.DeptId, True, "EXCLPROJ");  
 
If (&ret = %MDA_Success) Then 
   MessageBox(0, "Metadata Fn Status", 0, 0, "BulkInsertField succeeded"); 
Else 
   MessageBox(0, "Metadata Fn Status", 0, 0, "BulkInsertField failed"); 
End-If;

Syntax

BulkModifyPageFieldOrder({ProjectName | PageList}, ColNames, RequireAll, [ColWidths])

Description

Use the BulkModifyPageFieldOrder function to reorder the grid columns as specified by ColNames. If ColWidths is specified, the columns are also resized. This can also be used to modify a single columns width.

Note: You must have the role Peoplesoft Administrator assigned to your UserId in order to use this function.

If you specify a project name as a parameter, and if that project contains objects such as fields which have an upgrade action of delete, those objects are ignored.

The reordering algorithm “bunches” these fields together at the first instance of any of these fields in a target page grid, and forces the remaining fields into the order specified.

This function only reorders fields inside a grid.

If the fields occur twice or more in a grid, from two or more records, such as work records, the fields are bunched together in record groupings before being sorted into the order specified. For example, the two records ABS_HIST and PERSONAL_HISTORY both contain the fields DURATION_DAYS and DURATION_HOURS. The following is an example of how the records are fields would be bunched together first:

  • ABS_HIST, DURATION_DAYS

  • ABS_HIST, DURATION_HOURS

  • PERSONAL_HISTORY, DURATION_DAYS

  • PERSONAL_HISTORY, DURATION_HOURS

Note: These changes take affect after components are reloaded.

Using the Log File

Information about this operation is stored in a log field. The directory where the log file is placed depends on where the function is run from:

  • If the function is run in two-tier, the log file is located at PS_CFG_HOME /BulkOps.txt. This is also the default location if the system cannot find the other paths.

  • If the function is run from an application server, the log file is located here:

    PS_CFG_HOME /APPSERV/Domain_Name/LOGS/BulkOps.txt

  • If the function is run from an Application Engine program, the log file is written to the process' output log directory, that is:

    PS_CFG_HOME /APPSERV/prcs/Domain_Name/log_output/Process_Name_Instance/BulkOps.txt

Considerations Using this Function

This function is intended for use during configuration time only, before active runtime usage is initiated. Using this function during active runtime is not supported. Changes to data definitions are not recognized on currently loaded component. In general, changes aren't recognized until the component is reloaded.

Bulk operations are time consuming, therefore, referencing the log file to see the progress of an operation is recommended. These operations accommodate errors and continue processing, logging the overall progress of the operation.

Warning! These operations take place in a separate transaction from the page's save status: the initiation of any of these operations immediately changes the definitions, even if the page is subsequently cancelled.

Parameters

Field or Control

Definition

ProjectName | PageList

Specify either the name of a project that is the source of pages to use or an array of page names.

Note: When passing the project name as a parameter, if the project contains definitions with an upgrade action of delete, the system ignores those definitions.

ColNames

Specify an array of string that indicate which fields and the desired order of those fields.

RequireAll

Specify whether all the fields in ColNames must be present before changes are made or not. This parameter takes a Boolean value: True, all fields must be present.

ColWidths

Specify an array of number that gives the pixel widths of the grid columns. Use a -1 to indicate that the width of a column shouldn't change.

Returns

A constant value. The values are:

Value

Description

%MDA_Success

Bulk operation completed successfully.

%MDA_Failure

Bulk operation did not complete successfully.

Example

Local Array of String &ColOrder; 
Local Array of Number &ColWidth; 
Local String &pjm, &ret; 
 
&pjm = "MYPROJ"; 
&ColWidth = CreateArray(50, 100, -1); 
&ColOrder = CreateArray("DEPTID", "ORGID", "PROJECT"); 
 
&ret =  BulkModifyPageFieldOrder(&pjm, &ColOrder, True, &ColWidth); 
 
If (&ret = %MDA_Success) Then 
   MessageBox(0, "Metadata Fn Status", 0, 0, "BulkModifyPageFieldOrder succeeded"); 
Else 
      MessageBox(0, "Metadata Fn Status", 0, 0, "BulkModifyPageFieldOrder failed"); 
End-If;

Syntax

BulkUpdateIndexes([StringFieldArray])

Description

Use BulkUpdateIndexes to update indexes (PSINDEXDEFN table) for records that contain a field whose NotUsed setting has changed.

A field whose NotUsed flag has been set to True does not show up in indexes. The only way to modify a field's NotUsed setting is through an API call such as in the following example:

SetDBFieldNotUsed(FIELD.OrgId, True); 

The indexes of records that contain this field need to be updated to reflect the new settings.

Information about this operation can be logged by turning on PeopleCode tracing of internal functions (value 256.)

Considerations Using this Function

Do not invoke this function from runtime pages, as it modifies all records, including the records used to support the page it is invoked from. This function should be invoked from a Application Engine program.

Note: If you do call this function from a page the operation completes successfully, but the page returns an error message. Switching to a new component clears up this error, however, any changes not saved to the database are lost.

This function is intended for use during configuration time only, before active runtime usage is initiated. Using this function during active runtime is not supported. Changes to data definitions are not recognized on currently loaded component. In general, changes aren't recognized until the component is reloaded.

Bulk operations are time consuming, therefore, referencing the log file to see the progress of an operation is recommended. These operations accommodate errors and continue processing, logging the overall progress of the operation.

Calling this function without any parameter rebuilds the indexes for all records, an operation that may take hours. By indicating a list of fields whose NotUsed flag has changed, only the affected records have their indexes updated, reducing the time required to run this function.

Warning! These operations take place in a separate transaction from the page's save status: the initiation of any of these operations immediately changes the definitions, even if the page is subsequently cancelled.

Parameters

Field or Control

Definition

StringFieldArray

Specify an array of field names (as strings), such as DEPTID, representing the fields whose NotUsed flag has been modified. Only the records containing these fields are updated.

If you do not specify a value for this parameter, the indexes for all records are rebuilt.

Returns

A constant value. The values are:

Value

Description

%MDA_Success

Bulk operation completed successfully.

%MDA_Failure

Bulk operation did not complete successfully.

Example

The following example uses the function without the optional array of field names:

&ret =  BulkUpdateIndexes();  
If (&ret = %MDA_Success) Then 
MessageBox(0, "MetaData Fn Status", 0, 0, "BulkUpdateIndexes succeeded"); 
Else 
MessageBox(0, "MetaData Fn Status", 0, 0, "BulkUpdateIndexes failed"); 
End-If;

The following example uses the function with an array of two field names passed to it:

&ret =  BulkUpdateIndexes(CreateArray("DEPTID","PROJECT"));  
If (&ret = %MDA_success) Then 
MessageBox(0, "MetaData Fn Status", 0, 0, "BulkUpdateIndexes succeeded"); 
Else 
MessageBox(0, "MetaData Fn Status", 0, 0, "BulkUpdateIndexes failed"); 
End-If;