PeopleCode Built-in Functions and Language Constructs: J-L

The PeopleCode built-In functions and language constructs beginning with the letters J, K, and L are listed in alphabetical order within this topic.

Syntax

Left(source_str, num_chars)

Description

Use the Left function to return a substring containing the leftmost number of characters in source_str. num_chars specifies how many characters to extract. If the string contains Unicode non-BMP characters, each code unit of the surrogate pair is counted as a separate character and care should be taken not to split the surrogate pair.

Parameters

Field or Control

Definition

source_str

A String from which to derive the substring.

num_chars

A Number specifying how many characters to take from the left of source_str. The value of num_chars must be greater than or equal to zero. If num_chars is greater than the length of source_str, Left returns the entire string. If num_chars is omitted, it is assumed to be one.

Returns

Returns a String value derived from source_str.

Example

The following example sets &SHORT_ZIP to "90210":

&SHORT_ZIP = Left("90210-4455", 5);

Syntax

Len(str)

Description

Use the Len function to determine the number of characters in a string. If the string contains Unicode non-BMP characters, each code unit of the surrogate pair is counted as a separate character.

Returns

Returns a Number value equal to the number of characters, including spaces, in str.

Example

The following example sets &STRLEN to 10, then to 0:

&STRLEN = Len("PeopleSoft");
&STRLEN = Len("");

Syntax

Lenb(str)

Description

Note: This function has been deprecated and is no longer supported.

Syntax

LinearInterp(DataPoints)

Description

Use the LinearInterp function to compute a set of lines through a sequence of at least two points.

Parameters

Field or Control

Definition

DataPoints

This parameter takes an array of array of number. The array’s contents are an array of six numbers. The first two of these six numbers are the x and y points to be fit. The last four are the four coefficients to be returned from the function: a, b, c and d.a is the coefficient of the x0 term, b is the coefficient of the x1 term, c is the coefficient of the x2 term, and d is the coefficient of the x3 term.

Returns

A modified array of array of numbers. The elements in the array correspond to the elements in the array used for DataPoints. The c and d elements contain zeros.

Syntax

Ln(i)

Description

Use the Ln function to determine the natural logarithm of a number. Natural logarithms are based on the constant e, which equals 2.71828182845904. The number i must be a positive real number. Ln is the inverse of the Exp function.

Returns

A Number equal to the natural logarithm of i.

Example

The following examples set &I to 2.302585 and &J to 1:

&I = Ln(10);
&J = Ln(2.7182818);

Syntax

LoadABN(&DS_rowset, &chart_rowset, &relactions_rowset, node, initial_node[, disp_relactions][, fldr_img_class_ID][, CREF_img_class_ID])

Description

Note: SmartNavigation has been deprecated. This function remains for backward compatibility only.

Use this function to load data into the SmartNavigation chart and to generate an HTML code fragment that will be rendered in the browser as menu drop-downs, fly-outs, and breadcrumbs. The function loads data for the node specified by the node parameter from the rowset data source into the SmartNavigation chart rowset. If the data source contains siblings of node, the siblings are loaded and displayed in the chart at the same level as node.

The LoadABN function is applicable to rowset data sources only, and not to tree data sources. The standalone data source record specified by the &DS_rowset parameter must include the PT_ABNORGND_SBR, PT_ABNNDURL_SBR, PT_ABNNDDTL_SBR and PTORGBOXFLD_SBR subrecords in that order. Prior to calling the LoadABN function, data must be loaded from the applicable database data source into the standalone rowset data source.

Because this standalone rowset data source includes the PT_ABNORGND_SBR subrecord, the data is organized by an organization chart hierarchy of parent and child nodes. To simplify loading data from the database data source, it should also be organized using the organization chart hierarchy.

Parameters

Field or Control

Definition

&DS_rowset

Specifies the data source as a standalone rowset.

&chart_rowset

Specifies the SmartNavigation chart rowset. Typically, this is the rowset returned by the GetABNChartRowSet function.

&relactions_rowset

Specifies the related actions rowset. Typically, this is the rowset returned by the GetABNRelActnRowSet function.

node

Specifies the currently requested chart node. Typically, this is returned directly by calling the GetABNNode function.

initial_node

Specifies the initial chart node. Typically, this is returned directly by calling the GetABNInitialNode function.

disp_relactions

Specifies a Boolean value indicating whether to display the related actions folder in the fly-out menus. True indicates to display the related actions folder; False indicates that the related actions folder is not displayed. The default value is True.

This is an optional parameter. However, if you want to use custom folder or CREF icons (with the fldr_img_class_ID or CREF_img_class_ID parameters, respectively), you must explicitly define the disp_relactions parameter.

fldr_img_class_ID

Specifies the class ID for a custom folder icon as a string. This class must be defined in a style sheet, and the style sheet must be assigned to the SmartNavigation folder.

This is an optional parameter. To use the default folder icon, you can omit this parameter or specify the null string "". However, to ensure forward compatibility, you must specify the null string.

CREF_img_class_ID

Specifies the class ID for a custom CREF icon as a string. This class must be defined in a style sheet, and the style sheet must be assigned to the SmartNavigation folder.

This is an optional parameter. To use the default CREF icon, you can omit this parameter or specify the null string "". However, to ensure forward compatibility, you must specify the null string.

Returns

None.

Syntax

Local data_type &var_name [= expression]

Description

Use the Local statement to explicitly define local variables in PeopleCode.

Variable declarations can appear at the start of the program, intermixed with function declarations. Local variable declarations can also appear in the body of a program, including inside functions or methods.

The scope of local variables declared outside of a function or method is the PeopleCode program. The scope of local variables declared inside a function or method is to the end of the function or method. Also, these function local variables are different variables for each invocation of the function (even for recursive calls,) in the same manner as parameters.

Local variable declarations intermixed with the body of the program or inside functions or method can include initialization, that is, the variable can be set to a value at the same time it is declared.

In the absence of an initialization, the system automatically initializes temporary variables. Declared variables always have values appropriate to their declared type. Undeclared local variables are initialized as null strings.

Parameters

Field or Control

Definition

data_type

Any PeopleCode data type.

&var_name

A legal variable name.

expression

Specify the value of the variable. This parameter is optional.

Example

Local string &LOC_FIRST;

The following example scopes the variable &Constant as a local variable, as well as initializes it.

Local Number &Constant = 42;

Syntax

LogObjectUse([annotation])

Description

Use the LogObjectUse function to write to the system log a list of all the current PeopleCode objects with the current count, the object class name, and the maximum count of objects of this type.

While this function is mainly used to determine memory usage, the output is also an informative display of the object use in your system at a particular point in time.

Parameters

Field or Control

Definition

annotations

Specify a string to become the first line in the log file. This enables you to easily identify output corresponding to your use of this built-in.

Returns

None.

Example

The following is an example of output that can be generated in the system log.

PeopleCode side - after Java
         1902 JavaPeerReference                       
            0 Field                                              14
            0 ContentRefCollection                                4
            0 PortalCollection                                    3
           83 String                                         116459
            0 PT_NAV:NavEndNode                                   6
            0 PT_NAV:NavFolderNode                               35
            0 PT_NAV:NavTheme                                     1
            0 PT_NAV:NavNodeCollection                            4
            0 PortalRegistry                                      7
            0 PT_BRANDING:HeaderLinkBase                          1
            0 PT_NAV:NavNode                                     45
            0 PT_BRANDING:HeaderLinkHP                            1
            0 BIDocs                                              4
            0 PT_NAV:NavPortal                                    1
            1 SyncServer                                          1
            0 TabDefinition                                       1
          951 Rowset                                         220001
            0 FolderCollection                                    4
            0 SQL                                                 5
            0 Folder                                             69
            1 Response                                           14
            1 Foxtest                                             3
            0 Record                                              1
           23 Array                                             264
            1 Request                                            15
            0 AttributeCollection                                40
            0 UserHomepage                                        2
            0 Portal                                              3
            0 NodeCollection                                      3
            0 UserTabCollection                                   1
            0 ObjPropRef                                          3
          951 FOXTEST:Test                                   110001
            0 PT_BRANDING:BrandingBase                            3
            0 ContentRef                                         13
            0 PT_NAV:NavPagelet                                   1
            0 TabDefinitionCollection                             1
            0 Session                                            10
            0 NetworkNode                                         3

Syntax

Log10(x)

Description

Use the Log10 function to return the base-10 logarithm of a number x as a number value. The number x must be a positive real number.

Returns

Returns a Number equal to the base-10 logarithm of x.

Example

The following example sets &X to 1 and &Y to 1.39794:

&X = Log10(10);
&Y = Log10(25);

Syntax

Lower(string)

Description

Use the Lower function to convert all uppercase characters in a text string to lowercase characters and returns the result as a String value. Lower does not change characters that are not letters or characters do not have case sensitivity.

Returns

A String value equal to string, but in all lowercase format.

Example

The example sets &GOODKD to "k d lang":

&GOODKD = Lower("K D Lang");

Syntax

LTrim(string[, trim_string])

Description

Use the LTrim function to return a string formed by deleting from the beginning of string, all occurrences of each character in trim_string. If trim_string is omitted, " " is assumed; that is, leading blanks are trimmed.

If you need to trim a quotation mark, you need to escape it with a single ". For example

&TRIMMED = LTrim(&NAME, """");

Example

The following removes leading blanks from &NAME:

&TRIMMED = LTrim(&NAME);

The following removes leading punctuation marks from REC.INP:

&TRIMMED = LTrim(REC.INP, ".,;:!?");