PeopleCode Built-in Functions and Language Constructs: C

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

Syntax

CallAppEngine(applid[, statereclist, processinstance, allowcommit])

Where statereclist is list of record objects in the form:

&staterecord1 [, &staterecord2] .  .  .

There can be only as many record objects in statereclist as there are state records for the Application Engine program. Additional record objects are ignored.

Description

Use the CallAppEngine function to start the Application Engine program named applid. This is how to start your Application Engine programs synchronously from a page. (Prior to PeopleTools 8, you could do only this using the RemoteCall function.) Normally, you won’t run Application Engine programs from PeopleCode in this manner. Rather, the bulk of your Application Engine execution will be run using the Process Scheduler, and the exception would be done using CallAppEngine.

The staterecord can be the hard-coded name of a record, but generally you use a record object to pass in values to seed particular state fields. The record name must match the state record name exactly.

The processinstance allows you to specify the process instance used by the Application Engine runtime. In your PeopleCode program this parameter must be declared of type integer since that is the only way the runtime can tell whether the last parameter is to be interpreted as a process instance. For more details see the Application Engine documentation.

After you use CallAppEngine, you may want to refresh your page. The Refresh method, on a rowset object, reloads the rowset (scroll) using the current page keys. This causes the page to be redrawn. GetLevel0().Refresh() refreshes the entire page. If you want only a particular scroll to be redrawn, you can refresh just that part.

Note: If you supply a non-zero process instance, all message logging is done under the process instance. You must build your own PeopleSoft Pure Internet Architecture page to access or delete the messages, since there is no Process Monitor entry for the process instance you used.

PeopleCode Event Considerations

You must include the CallAppEngine PeopleCode function within events that allow database updates because generally, if you’re calling Application Engine, you’re intending to perform database updates. This includes the following PeopleCode events:

  • SavePreChange (Page)

  • SavePostChange (Page)

  • Workflow

  • FieldChange

If CallAppEngine results in a failure, all database updates is rolled back. All information the user entered into the component is lost, as if the user pressed ESC.

Application Engine Considerations

You can also use the CallAppEngine function in a Application Engine program, either directly (in a PeopleCode action) or indirectly (using a Component Interface). This functionality must be used carefully, and you should only do this once you have a clear understanding of the following rules and restrictions.

  • Dedicated cursors are not supported inside a "nested application engine instance" (meaning an application engine program invoked using CallAppEngine from within another application engine program). If a nested application engine instance has any SQL actions with ReUse set to Yes or Bulk Insert, those settings are ignored.

  • As in any other type of PeopleCode event, no commits are performed within the called application engine program. This is an important consideration. If a batch application engine program called another program using CallAppEngine, and that child program updated many rows of data, the unit-of-work might become too large, resulting in contention with other processes. A batch application engine program should invoke such child programs using a Call Section action, not CallAppEngine.

  • Temp tables are not shared between a batch application engine program and child program invoked using CallAppEngine. Instead, the child program is assigned an "online" temporary table instance, which is used for all temp tables in that program. In addition, if that child program invokes another program using CallAppEngine, that grandchild shares the online temp instance with the caller. In other words, only one online temp instance is allocated to a process at any one time, no matter how many nested CallAppEngine's there might be.

  • The lock on an online temp instance persists until the next commit. If the processing time of the called program is significant (greater than a few seconds), this would be unacceptable. As a general rule, application engine programs that make use of temp tables and have a significant processing time should be called from other application engine programs using a Call Section action, not CallAppEngine.

See Using PeopleCode in Application Engine Programs.

Save Events Considerations

To execute the Application Engine program based on an end user Save, use the CallAppEngine function within a Save event. When you use CallAppEngine, you should keep the following items in mind:

  • No commits occur during the entire program run.

  • During SavePreChange, any modified rows in the page have not been written to the database.

  • During SavePostChange, the modified rows have been written to the database. The Page Process issues one commit at the end of the Save cycle.

FieldChange Considerations

If you don’t want the CallAppEngine call to depend on a Save event, you can also initiate CallAppEngine from a FieldChange event. When having a FieldChange event initiate CallAppEngine, keep the following items in mind:

  • No commits occur within the program called by CallAppEngine. The called program remains a synchronous execution in the same unit of work.

  • The Component Processor commits all updates done in a FieldChange at the end of the event, which frees any locks that the Application Engine program might have acquired.

  • Do not include a DoSave function in the same FieldChange event. Not only is this not allowed, but it also indicates that you should be including the CallAppEngine within a Save event.

  • You can use the DoSaveNow function in the same FieldChange event, but it must be called prior to the first CallAppEngine function, but not afterward.

Parameters

Field or Control

Definition

applid

Specify the name of the Application Engine program you want to start.

statereclist

Specify an optional record object that provides initial values for a state record.

processinstance

Optionally, specify the process instance used by the Application Engine runtime. If no value is specified, the Application Engine runtime automatically generates a new process instance.

allowcommit

Specify an optional Boolean value indicating whether intermediate commits are allowed. If omitted, allowcommit defaults to False.

Intermediate commits of only the transactions that are related to the Application Engine program use a secondary connection to the database. Before invoking CallAppEngine with intermediate commits, the secondary connection to the database for that application server domain must be enabled using the database flags (DbFlags) in the application server configuration file. Note that the secondary connections are enabled by default. If the secondary connection to the database is disabled and CallAppEngine is invoked with allowcommit set to True, the functionality will fall back to the default where all transactions are committed only at the end of an Application Engine program.

See PSTOOLS Options

Returns

None.

Example

The following calls the Application Engine program named MYAPPID, and passes initialization values.

&REC = CreateRecord(RECORD.INIT_VALUES); 
&REC.FIELD1.Value = "XYZ";   
   /* set the initial value for INIT_VALUES.FIELD1 */ 
CallAppEngine("MYAPPID", &REC);

Syntax

CancelPubHeaderXmlDoc(PubID, PubNode, ChannelName, VersionName)

Description

Use the CancelPubHeaderXmlDoc function to programmatically cancel the message header of a publication contract, much the same as you can do in the message monitor.

Note: This function has been deprecated and remains for backward compatibility only. Use the IntBroker class Cancel method instead.

The message header, also known as the message instance, is the published message before the system performs any transformations.

The function is only available when the message has one of the following statuses:

  • Error

  • New

  • Retry

  • Timeout

  • Edited

Related Links

Cancel

Parameters

Field or Control

Definition

PubID

Specify the PubID of the message.

PubNode

Specify the Pub Node Name of the message.

ChannelName

Specify the channel name of the message.

VersionName

Specify the version name of the message.

Returns

A Boolean value: True if the function completed successfully, False otherwise.

Syntax

CancelPubXmlDoc(PubID, PubNode, ChannelName, VersionName, MessageName, SubNode[, Segment])

Description

Use the CancelPubXmlDoc function to programmatically cancel a message publication contract, much the same as you can do in the message monitor.

Note: This function has been deprecated and remains for backward compatibility only. Use the IntBroker class Cancel method instead.

This is the publication contract that exists after any transformations have been preformed.

The function is only available when the message has one of the following statuses:

  • Error

  • New

  • Retry

  • Timeout

  • Edited

Related Links

Cancel

Parameters

Field or Control

Definition

PubID

Specify the PubID of the message.

PubNode

Specify the Pub Node Name of the message.

ChannelName

Specify the channel name of the message.

VersionName

Specify the version name of the message.

MessageName

Specify the name of the message.

SubNode

Specify the subnode of the message.

Segment

Specify an integer representing which segment you want to access. The default value is one, which means that if you do not specify a segment, the first segment is accessed.

Returns

A Boolean value: True if the function completed successfully, False otherwise.

Syntax

CancelSubXmlDoc(PubID, PubNode, ChannelName, VersionName, MessageName, SubscriptionName[, Segment])

Description

Use the CancelSubXmlDoc function to programmatically cancel a message subscription contract, much the same as you can do in the message monitor.

Note: This function has been deprecated and remains for backward compatibility only. Use the IntBroker class Cancel method instead.

The function is only available when the message has one of the following statuses:

  • Error

  • New

  • Retry

  • Timeout

  • Edited

Related Links

Cancel

Parameters

Field or Control

Definition

PubID

Specify the PubID as a string.

PubNode

Specify the Pub Node name as a string.

ChannelName

Specify the Channel name as a string.

VersionName

Specify the version name as a string.

MessageName

Specify the message name as a string.

SubscriptionName

Specify the subscription name as a string.

Segment

Specify an integer representing which segment you want to access. The default value is one, which means that if you do not specify a segment, the first segment is accessed.

Returns

A Boolean value: True if function completed successfully, False otherwise.

Syntax

ChangeEmailAddress(Type, Address)

Description

Use the ChangeEmailAddress function to change the type of an email address that you've already added for the current user. You can only have one email address of a specific type for a user. If you try to use a type that already has an email address associated with it, you receive an error.

Parameters

Field or Control

Definition

Type

Specify the type that you want to change the email address to. This parameter takes a string value. The valid values are:

Value

Description

BB

Blackberry email address

BUS

Business email address

HOME

Home email address

OTH

Other email address

WORK

Work email address

Field or Control

Definition

Address

Specify the email address that you want to add as a string.

Returns

None.

Syntax

Char(n)

Description

Use the Char function to convert a decimal numeric value n to the corresponding Unicode character.

Parameters

Field or Control

Definition

n

The numeric value to be expressed as a decimal Unicode value.

Returns

Returns a string representing the Unicode character corresponding to the number n.

Example

This example sets three strings:

&STRING1 = Char(80) | Char(83);
&STRING2 = Char(26085) | Char(26412);
&STRING3 = Char(55362) | Char(56697);

The following table shows the Unicode hexadecimal code points and the string equivalents for these calls to the Char function:

Variable

Char (Decimal)

Unicode Code Points

String

&STRING1

Char(80) | Char(83)

U+0050, U+0053

PS

&STRING2

Char(26085) | Char(26412)

U+65E5, U+672C

日本

&STRING3*

Char(55362) | Char(56697)

U+D842 U+DD79

A single Chinese character

* The single character in &STRING3 signifies a non-BMP, UTF-32 character (U+20979), which is represented by the UTF-16 surrogate pair (U+D842 U+DD79). This single Chinese character has been omitted from this example.

For reference, Unicode character charts are available from The Unicode Consortium.

See Unicode 6.2 Character Code Charts.

Syntax

CharType(source_str, char_code) 

Description

Use the CharType function to determine whether the first character in source_str is of type char_code . The char_code parameter is a numeric value representing a character type (see the following Parameters section for details). Most character types supported by this function equate to specific Unicode character blocks or are based on Unicode character properties.

Parameters

Field or Control

Definition

source_str

A String, the first character of which will be tested.

char_code

A Number representing the character type to be tested for.

The following table shows valid values for char_code. You can specify either a Character Code or a Constant:

Numeric Value

Constant

Character Set

0

%CharType_AlphaNumeric

Basic Latin — Alphanumeric (printable range of 7-bit US-ASCII), Unicode characters in the range U+0020 — U+007E

1

%CharType_ExtendedLatin1

Extended Latin-1 characters (ISO 8859-1 accents for Western European languages), Unicode characters in the range U+00BF — U+07E

2

%CharType_HankakuKatakana

Hankaku Katakana (half-width Japanese Katakana)

3

%CharType_ZenkakuKatakana

Zenkaku Katakana (full-width Japanese Katakana)

4

%CharType_Hiragana

Hiragana (Japanese)

5

%CharType_Kanji

Chinese, Japanese and Korean ideographic characters. Includes Japanese Kanji, Chinese Hanzi and Korean Hancha.

6

%CharType_DBAlphaNumeric

Full-width Latin Alphanumeric characters, primarily used for Japanese. Excludes

7

None

Korean Hangul syllables, excluding Hangul Jamo.

8,9

None

Reserved for future use.

10

%CharType_JapanesePunctuation

Full- and half-width punctuation, including space (U+0020) and Fullwidth / Ideographic Space (U+3000).

11

None

Greek

12

None

Cyrillic

13

None

Armenian

14

None

Hebrew

15

None

Arabic

16

None

Devanagari

17

None

Bengali

18

None

Gurmukhi

19

None

Gujarati

20

None

Oriya

21

None

Tamil

22

None

Telugu

23

None

Kannada

24

None

Malayalam

25

None

Thai

26

None

Lao

27

None

Tibetan

28

None

Georgian

29

None

Bopomofo

Returns

CharType returns one of the following Number values. You can check for the constant values instead of the numeric values if you prefer:

Numeric Value

Constant Value

Description

1

%CharType_Matched

Character is of type char_code.

0

%CharType_NotMatched

Character is not of type char_code.

-1

%CharType_Unknown

UNKNOWN: unable to determine whether character is of set char_code. This occurs if the character being checked is an unallocated Unicode codepoint, or was added in a version of Unicode greater than that supported by PeopleTools.

Example

This example tests to see if a character is Hiragana:

&ISHIRAGANA = CharType(&STRTOTEST, %CharType_Hiragana); 
If &ISHIRAGANA = 1 Then 
   WinMessage("Character type is Hiragana"); 
Else 
   If &ISHIRAGANA = 0 Then 
      WinMessage("Character type is not Hiragana"); 
   Else 
      WinMessage("Character type is UNKNOWN"); 
   End-If; 
End-If;

Syntax

ChDir(path)

Description

Use the ChDir function to change the current directory on a drive. This is similar to the DOS ChDir command. The drive and the directory are both specified in a path string.

Note: This function has been deprecated.

Syntax

ChDrive(str_dr)

Description

Use the ChDrive function to change the current disk drive to the drive specified by str_dr, which is a string consisting of a valid drive letter followed by a colon, for example "C:".

Note: This function has been deprecated.

Syntax

CheckMenuItem(BARNAME.menubar_name, ITEMNAME.menuitem_name)

Description

Use the CheckMenuItem function to change the menu state by placing a check mark beside the menu item.

Note: This function has been deprecated.

Syntax

ChunkText(string, delimiter [, chunk_size])

Description

Use the ChunkText function to break a long text string into chunks that can be more readily managed by a storage system, such as a database text field. You must specify a string delimiter; the chunk size is optional.

Parameters

Field or Control

Definition

string

Specify the text to be split into chunks as a string.

delimiter

Specify a single character as a text delimiter.

chunk_size

Specify the chunk size in characters as a number.

If you specify no value, 0, or a number greater than 14000, the default value of 14000 is used.

Returns

An array of string.

Example

Local array of string &chunkList;

&STRINGTOCHUNK = "NewYorkNewYorkNewYorkNewYorkNewYorkNewYorkNewYorkNewYorkNewYorkNewYorkNewYorkNewYorkNewYorkNewYorkNewYorkNewYork";
&DELIM = "r";
&CHUNKSIZE = 8;

&chunkList = ChunkText(&STRINGTOCHUNK, &DELIM, &CHUNKSIZE);

The preceding example produces the following 16 chunks:

[NewYor][kNewYor][kNewYor][kNewYor][kNewYor][kNewYor][kNewYor][kNewYor][kNewYor][kNewYor][kNewYor][kNewYor][kNewYor][kNewYor][kNewYor][kNewYork]

Syntax

Clean(string)

Description

Use the Clean function to remove all non-printable characters, such as control codes, end of line marks, and unpaired Unicode combining marks, from a text string and return the result as a String value. It is intended for use on text imported from other applications that contains characters that may not be printable. Frequently, low-level characters appear at the beginning and end of each line of imported data, and they cannot be printed.

Note: All white space characters (for example, a blank space, a tab, a carriage return, and so on) are deemed printable. Therefore, they are not be removed by the Clean function.

Parameters

Field or Control

Definition

string

Specifies the text to be cleaned as a string.

Returns

Returns a String value purged of non-printable characters.

Example

Because Char(7) (U+0007) is a non-printable character, the following Clean function returns a null string:

&CLEANSTR = Clean(Char(7));

Syntax

CleanAttachments(([PreserveCaseHint])

Description

Use the CleanAttachments function to delete all unreferenced (orphaned) files from database tables serving as file storage locations.

Note: CleanAttachments operates only on database tables that have been used as file attachment storage locations, and not on FTP sites or HTTP repositories.

Warning! There is no way to roll back changes made by the CleanAttachments function. Oracle recommends that you perform a database backup before invoking this function.

It is important that you understand how the system determines that a file is unreferenced, and how it determines which tables contain file attachments.

CleanAttachments compiles two lists:

  • List 1: A list of file references that is constructed by finding all the distinct values in the ATTACHSYSFILENAME column in each table with a record definition that contains the FILE_ATTACH_SBR subrecord (at any level). Any file not in this list is considered not referenced (orphaned).

  • List 2: A list of actual stored files that is constructed by finding the distinct values in the ATTACHSYSFILENAME column in each table with a record definition that contains the FILE_ATTDET_SBR subrecord at the top level.

The system deletes any file that appears in the second list, but not in the first, after having determined the effect of the optional PreserveCaseHint parameter.

Note: A table is only considered to contain file references if its associated record contains the FILE_ATTACH_SBR subrecord (at any level). If an application has stored file references in tables that do not contain the FILE_ATTACH_SBR subrecord, and you invoke the CleanAttachments function, then all the files uploaded to the database through that application will be deleted because the files will not be found in list 1 and the system therefore regards them as unreferenced.

Similarly, the FILE_ATTDET_SBR subrecord must be at the top level of the table that contains the actual attachments or the table will be ignored by CleanAttachments. In this case, CleanAttachments does not find any files to delete and does nothing at all.

To schedule a regular job to clean up orphaned file attachments, you can use the CLEANATT84 Application Engine program, which can be executed from the Delete Orphan Files (Batch) page. See Delete Orphan Files (Batch) for more information.

Alternatively, you can use the Manage Attachment Repositories page to execute CleanAttachments directly in a synchronous manner. See “Deleting Orphan Attachments” in Manage Attachment Repositories for more information.

Important! Executing CleanAttachments directly in a synchronous manner may result in a timeout if the number of file attachments to be processed is large. Therefore, Oracle recommends that you use the batch processing interface instead.

Parameters

Field or Control

Definition

PreserveCaseHint

An optional integer parameter that provides the CleanAttachments function with a hint about how the PreserveCase parameter was used when the files were originally uploaded—that is, whether the PreserveCase parameter was True, False, or a mix of the two.

The default value is %CleanAttach_Default (a mix of the two).

For PreserveCaseHint, specify one of the following constant values:

Numeric Value

Constant Value

Description

0

%CleanAttach_Default

Indicates that the comparison is to be performed as if PreserveCase were True when some of the files were uploaded to this database and False for others. Therefore, a file in list 2 (actual stored files) is retained if it would have been retained had PreserveCaseHint been specified as either %CleanAttach_PreserveCase or %CleanAttach_NoPreserveCase. Otherwise, the file is considered an orphan and is deleted.

1

%CleanAttach_PreserveCase

Indicates that the comparison is to be performed as if PreserveCase were True when all the files were uploaded to this database. Therefore, the comparison between list 1 and list 2 requires an exact match of the file name including its file extension. Any files in list 2 (actual stored files) that do not have an exact match in list 1 (names of referenced files) are deleted.

2

%CleanAttach_NoPreserveCase

Indicates that the comparison is to be performed as if PreserveCase were False when all the files were uploaded to this database. Therefore, the comparison between list 1 and list 2 will be performed only after the file extension of each file in list 1 is lowercased. Any files in list 2 (actual stored files) that do not have an exact match in list 1 (names of referenced files) after lowercasing the file extension in list 1 are deleted.

The following table summarizes the action of CleanAttachments on five different stored files depending on the values found in the file reference table and depending on the value of the optional PreserveCaseHint parameter. CleanAttachments will either retain or delete the file from the file storage tables.

System File Name in File Storage Tables (List 2)

System File Name in File Reference Tables (List 1)

PreserveCaseHint = %CleanAttach_ Default

PreserveCaseHint = %CleanAttach_ PreserveCase

PreserveCaseHint = %CleanAttach_ NoPreserveCase

file1.txt

file1.txt

Retain

Retain

Retain

file2.txt

file2.TXT

Retain

Delete

Retain

file3.TXT

file3.TXT

Retain

Retain

Delete

file4.TxT

file4.TXT or file4.txt

Delete

Delete

Delete

file5.txt

none found

Delete

Delete

Delete

Returns

An integer value. You can check for either an integer or a constant value:

Note: Because CleanAttachments is designed to work with multiple files, to track errors when using CleanAttachments set your PeopleCode trace to 2112 and your SQL trace to 15 so that errors will be written to the appropriate trace files.

Numeric Value

Constant Value

Description

0

%Attachment_Success

Files were deleted successfully.

1

%Attachment_Failed

Files were not deleted successfully.

The following are some possible situations where %Attachment_Failed could be returned:

  • Failed to initialize the process due to some internal error.

  • Failed due to unexpected/bad reply from server.

  • Failed to allocate memory due to some internal error.

  • Failed due to timeout.

  • Failed due to non-availability of space on FTP server.

  • Failed to close SSL connection.

  • Failed due to an unspecified error on the HTTP repository.

    If the HTTP repository resides on a PeopleSoft web server, then you can configure tracing on the web server to report additional error details.

    See Enabling Tracing on the Web Server or Application Server.

Example

&retcode = CleanAttachments(%CleanAttach_PreserveCase);

Syntax

ClearKeyList()

Description

Use the ClearKeyList function to clear the current key list. This function is useful for programmatically setting up keys before transferring to another component.

Returns

Optionally returns a Boolean value indicating whether the function succeeded.

Example

The following example sets up a key list and then transfers the user to a page named PAGE_2.

ClearKeyList( );
AddKeyListItem(OPRID, OPRID);
AddKeyListItem(REQUEST_ID, REQUEST_ID);
SetNextPage("PAGE_2");
TransferPage( );

Syntax

ClearSearchDefault([recordname.]fieldname)

Description

Use the ClearSearchDefault function to disable default processing for the specified field, reversing the effects of a previous call to the SetSearchDefault function.

Note: This function remains for backward compatibility only. Use the SearchDefault Field class property instead.

If search default processing is cleared for a record field, the default value specified in the record field properties for that field will not be assigned when the field appears in a search dialog box. This function is effective only when used in SearchInit PeopleCode.

Parameters

Field or Control

Definition

[recordname .]fieldname

The name of the target field, which is a search key or alternate search key that is about to appear in a search dialog box. You must supply the recordname only if the record field and your PeopleCode program are in different locations.

Returns

Optionally returns a Boolean value indicating whether the function succeeded.

Syntax

ClearSearchEdit([recordname.]fieldname)

Description

Use the ClearSearchEdit function to reverse the effects of a previous call to the SetSearchEdit function. If ClearSearchEdit is called for a specific field, the edits specified in the record field properties will not be applied to the field when it occurs in a search dialog.

Note: This function remains for backward compatibility only. Use the SearchEdit Field class property instead.

Parameters

Field or Control

Definition

[recordname .]fieldname

The name of the target field, which is a search key or alternate search key about to appear in a search dialog box. The recordname prefix is not required if the program that calls ClearSearchEdit is on the recordname record definition.

Returns

Optionally returns a Boolean value indicating whether the function succeeded.

Syntax

Code(str)

Description

Use the Code function to return the numerical Unicode UTF-16 value for the first character in the string str. (Normally you would pass this function a single character.) If the string starts with a non-BMP Unicode character, the value returned will be that of the Unicode high surrogate of the character (the first value of the surrogate pair).

Returns

Returns a Number value equal to the character code for the first character in str.

Syntax

Codeb(str)

Description

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

Syntax

CollectGarbage()

Description

Use the CollectGarbage function to remove any unreachable application objects created by the Application Classes.

Sometimes there may be unrecoverable application objects that are can no longer be referenced from PeopleCode, but which have not been reclaimed and so are still taking up computer memory. Generally this situation arises only if you have application objects that form into loops of references.

This function is automatically invoked by the application server as part of its end-of-service processing, so generally you do not need to call it for online applications. However, in Application Engine (batch), it is possible that a long-running batch job could grow in memory usage over time as these unreferencable Application Objects accumulate. The solution to such a problem is to call CollectGarbage periodically to reclaim these objects.

Parameters

None.

Returns

None.

Syntax

CommitWork()

Description

Use the CommitWork function to commit pending changes (inserts, updates, and deletes) to the database.

Considerations for Using CommitWork

The following are the considerations for using CommitWork.

  • This function is available in Application Engine PeopleCode, the FieldChange and SavePreChange events. If you use it anywhere else, you'll receive a runtime error.

  • When used with an Application Engine program, this function only applies to those Application Engine programs that run in batch (not online). If the program is invoked using the CallAppEngine function, the CommitWork call is ignored. The same is true for commit settings at the section or step level.

  • This function can only be used in an Application Engine program that has restart disabled. If you try to use this function in a program that doesn't have restart disabled, you'll receive a runtime error.

  • Component interfaces that rely on CommitWork to save data cannot be used in the Excel to Component Interface utility.

  • When CommitWork is called in the context of a component interface (such as, during a SavePreChange PeopleCode program that's associated with the component), if the caller of the component interface already has an open cursor (such as an active SQL object) the Commit does not take effect immediately, but only when the last cursor is closed.

See CallAppEngine.

FieldChange and SavePreChange Considerations

The following are the FieldChange and SavePreChange considerations:

  • All updates done in FieldChange (including those using CallAppEngine) should be considered a single database transaction. This is a fundamental change: previously, a single transaction was represented by a page or a component.

  • A consequence of this is that a message requiring a reply, or any other think-time action, causes a fatal error if located in FieldChange after a database update that has not been committed to the database using the CommitWork function. So it is possible for an application to update the database in FieldChange, then do a think-time action, by preceding the think-time action with a call to CommitWork.

  • CommitWork commits the updates and closes the database transaction (that is, the unit of work). The consequence of using CommitWork is that because it closes the database transaction, any subsequent rollback calls will not rollback the committed updates.

  • Just as any database updates in FieldChange required careful application design to ensure that the transaction model is appropriate, so too does the use of CommitWork.

  • When using CommitWork in the Component Processor environment (as opposed to using it in an Application Engine program) CommitWork produces an error if there are any open cursors, such as any open PeopleCode SQL objects.

See FieldChange Event.

Application Engine Considerations

The CommitWork function is useful only when you are doing row-at-a-time SQL processing in a single PeopleCode program, and you must commit without exiting the program. In a typical Application Engine program, SQL commands are split between multiple Application Engine actions that fetch, insert, update, or delete application data. Therefore, you would use the section or step level commit settings to manage the commits. This is the recommended approach.

However, with some types of Application Engine programs that are PeopleCode intensive, it can be difficult to exit the PeopleCode in order to perform a commit. This is the only time when the CommitWork function should be used.

See Restarting Application Engine Programs.

Restart Considerations

Disabling restart on a particular program means that the application itself is intrinsically self-restartable: it can be re-run from the start after an abend, and it performs any initialization, cleanup, and filtering of input data to ensure that everything gets processed once and only once, and that upon successful completion, the database is in the same state it would have been if no abend occurred.

Set-based applications should always use Application Engine's restart. Only row-by-row applications that have restart built into them can benefit from disabling Application Engine's restart.

Consider the following points to managing restarts in a self-restarting program:

  • Locking input transactions (optional).

    If the input data can change, and if it's important not to pick up new data during a restart, there should be logic to lock transactions at the start of the initial run (such as updating rows with current Process Instance). The program should first check whether any rows have the current Process Instance (that is, is the process being restarted from the top after an abend?). If no rows found, do the update.

    In some cases it is acceptable for a restarted process to pick up new rows, so that locking is not necessary. It depends on your application.

    Also, if you do not lock transactions, you must provide some other way to manage concurrent processing of the same program. You do not want two simultaneous runs of the same program to use the same data, so you must have some strategy for dividing up the data such that there is no overlap.

  • Filtering input transactions (required).

    After an input transaction is processed, the row should be updated accordingly (that is, setting a "processed" flag). The SELECT statement that drives the main processing loop should include a WHERE condition to filter out rows that have already been processed.

Returns

A Boolean value, True if data was successfully committed, False otherwise.

Example

The following example fetches rows and processes them one at a time, committing every 100 iterations. Because restart is disabled, you must have a marker indicating which rows have been processed, and use it in a conditional clause that filters out those rows.

Local SQL &SQL; 
Local Record &REC; 
Local Number &COUNT; 
 
&REC = CreateRecord(RECORD.TRANS_TBL); 
&SQL = CreateSQL("%SelectAll(:1) WHERE PROCESSED <> 'Y'"); 
&COUNT = 0; 
 
&SQL.Execute(&REC); 
While &SQL.Fetch(&REC) 
   If (&COUNT > 99) Then 
      &COUNT = 0; 
      CommitWork();   /* commit work once per 100 iterations */ 
   End-if; 
   &COUNT = &COUNT + 1; 
   /* do processing */ 
   ... 
 
   /* update transaction as "processed" */ 
   &REC.PROCESSED.Value = 'Y'; 
   &REC.Update(); 
End-While;

Syntax

CompareLikeFields(from, to)

where from and to are constructions that reference rows of data on specific source and target records in the component buffer; each have the following syntax:

level, scrollpath, target_row

and where scrollpath is:

[RECORD.level1_recname, level1_row, [RECORD.level2_recname, level2_row, ]] RECORD.target_recname

To prevent ambiguous references, you can use SCROLL. scrollname, where scrollname is the same as the scroll level’s primary record name.

Description

Use the CompareLikeFields function to compare fields in a row on a specified source record to similarly named fields on a specified target record.

Note: This function remains for backward compatibility only. Use the CompareFields record class method instead.

If all of the like-named fields have the same data value, CompareLikeFields returns True; otherwise it returns False.

Parameters

Field or Control

Definition

from

A placeholder for a construction (level, scrollpath, target_row) that references the first row in the comparison.

to

A placeholder for a construction (level, scrollpath, target_row) that references the second row in the comparison.

level

Specifies the scroll level for the target level scroll.

scrollpath

A construction that specifies a scroll level in the component buffer.

target_row

Specifies the row number of each target row on its scroll level.

Returns

Returns a Boolean value indicating whether all of the like-named fields in the two records have the same data value.

Example

The following example compares the like-named fields in two rows on levels 1 (&L1_ROW) and 2 (&L2_ROW) and returns True if all of the like-named fields in the two rows have the same value.

&L1_ROW = 1;
&L2_ROW = 1;
If CompareLikeFields(1, RECORD.BUS_EXPENSE_PER, &L1_ROW, 2, RECORD.BUS_EXPENSE_PER, 1, RECORD.BUS_EXPENSE_DTL, &L2_ROW) Then
   WinMessage("The fields match.");
End-If;

Syntax

CompareStrings(new_text, old_text [, content_type [, delimiter]])

Description

Use the CompareStrings function to compare the content of new_text with the content of old_text and return an XML-formatted text string detailing the differences between the two strings.

The XML string indicates the type of change for each line or text segment, based on the delimiter, as shown in the following table:

Notation

Description

None

Both lines are the same

Insert

A line is present in new_text that is not in old_text.

Delete

A line is absent in new_text that is present in old_text.

Change

A change in a line shows as an Insert in new_text and a Delete in old_text.

Parameters

Field or Control

Definition

new_text

Specifies the string that you want to compare with the old version of the string.

old_text

Specifies the old version of the string for comparison.

content_type

Specifies the content type as a literal: text or html. This parameter is optional.

If content_type is html, HTML tags are stripped and are not included in the comparison.

If content_type is not specified, it is set by default to text.

delimiter

An array of string specifying the delimiters to be used to split the content for comparison. This parameter is optional.

If content_type is text and delimiter is not specified, the delimiter is set by default to char(13) (or \n, a carriage return).

If content_type is html and delimiter is not specified, the delimiter array is populated by default with the following values:

["</p>", "</br>", "</h1>", "</h2>", "</h3>", "</h4>", "</h5>", "</h6>", "</div>", "</address>", "</pre>", "</br>", "</tr>", "</caption>", "</blockquote>"]

Returns

Returns a String in XML format showing the differences between the two input strings.

Example

This example shows a comparison of two text strings.

The variable &NewText contains the following string:

Line 2.
Line 2.1.
Line 2.2.
Line 3.
Line 5.
Line 6.
Line 8.

The variable &OldText contains the following string:

Line 1.
Line 2.
Line 3.
Line 4.
Line 7.

The following PeopleCode statement compares the two ASCII-formatted text strings, &NewText and &OldText.

&OutputXML = CompareStrings(&NewText, &OldText, "Text");

The string variable &OutputXML contains the following text:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<CompareReport ContentType="text" Delimitter="&#xA;">
	<FileContent Difference="Deleted">
		<Line Num="1">
			<LineContent>Line 1.</LineContent>
		</Line>
	</FileContent>
	<FileContent Difference="None">
		<Line Num="1" OldLineNum="2">
			<LineContent>Line 2.</LineContent>
		</Line>
	</FileContent>
	<FileContent Difference="Inserted">
		<Line Num="2">
			<LineContent>Line 2.1.</LineContent>
		</Line>
		<Line Num="3">
			<LineContent>Line 2.2.</LineContent>
		</Line>
	</FileContent>
	<FileContent Difference="None">
		<Line Num="4" OldLineNum="3">
			<LineContent>Line 3.</LineContent>
		</Line>
	</FileContent>
	<FileContent Difference="Changed">
		<OldLine Num="4">
			<LineContent>Line</LineContent>
			<LineContent Changed="Deleted">4.</LineContent>
		</OldLine>
		<Line Num="4">
			<LineContent>Line</LineContent>
			<LineContent Changed="Inserted">5.</LineContent>
		</Line>
		<OldLine Num="5">
			<LineContent>Line</LineContent>
			<LineContent Changed="Deleted">7.</LineContent>
		</OldLine>
		<Line Num="5">
			<LineContent>Line</LineContent>
			<LineContent Changed="Inserted">6.</LineContent>
		</Line>
	</FileContent>
	<FileContent Difference="Inserted">
		<Line Num="7">
			<LineContent>Line 8.</LineContent>
		</Line>
	</FileContent>
</CompareReport>

This example shows a comparison of two HTML strings.

The variable &NewHTML contains the following string:

<p><H1>peoplesoft<B>file<B> difference utility
<I>Peopletools<I> Release &lt;6 and &gt;5 </H1></p>
<p> &lt;BOLD&gt;Hello world<ITALIC></p>

The variable &OldHTML contains the following string:

<p><H1>peoplesoft<B>file<B>difference utility
<I>Peopletools<I> Release &lt;7 and &gt;5 </H1></p>
<p> &lt;BOLD&gt;Hello world<ITALIC></p>

The following PeopleCode statement compares the two HTML-formatted text strings, &NewHTML and &OldHTML.

&OutputXML = CompareStrings(&NewHTML, &OldHTML, "HTML");

The string variable &OutputXML contains the following text:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<CompareReport Delimitter="</p>,</H1>" ContentType ="html">
	<FileContent Difference="Changed">
		<OldLine Num="1">
			<LineContent Changed="Deleted">peoplesoftfile difference</LineContent>
			<LineContent>utility Peopletools Release</LineContent>
			<LineContent Changed="Deleted ">&lt;6</LineContent>
			<LineContent>and &gt;5 </LineContent>
		</OldLine>
		<Line Num="1">
			<LineContent Changed="Inserted">peoplesoftfiledifference</LineContent>
			<LineContent>utility Peopletools Release</LineContent>
			<LineContent Changed="Inserted ">&lt;7</LineContent>
			<LineContent>and &gt;5 </LineContent>
		</Line>
	</FileContent>
	<FileContent Difference="None">
		<Line Num="2" OldLineNum="2">
			<LineContent>&amp;lt;BOLD&amp;gt;Hello world</LineContent>
		</Line>
		<Line Num="3" OldLineNum="3">
			<LineContent></LineContent>
		</Line>
	</FileContent>
</CompareReport>

Syntax

CompareTextDiff(new_text, old_text [, content_type [, delimiter]]) 

Description

Use the CompareTextDiff function to compare the content of new_text with the content of old_text and return an array of array of any detailing the differences between the two strings. The elements of the returned subarray are as follows:

Element

Data Type

Description

index

number

The sequential index number in the comparison array.

line

number

The line number for the line of text being compared.

subline

number

The subline is the counter of added lines that exist in the new_text.

Note: For DELETE, CHANGED and COMMON operations, 0 is always reported for the subline.

type

string

The type of difference:

  • COMMON – Both lines are the same

  • ADD – A line is present in new_text that is not in old_text.

  • DELETE – A line is absent in new_text that is present in old_text.

  • CHANGED – A change in a line shows as an Add in new_text and a Delete in old_text.

text

string

The actual text being compared.

Parameters

Field or Control

Definition

new_text

Specifies the string that you want to compare with the old version of the string.

old_text

Specifies the old version of the string for comparison.

content_type

Specifies the content type as a literal: text or html. This parameter is optional.

If content_type is html, HTML tags are stripped and are not included in the comparison.

If content_type is not specified, it is set by default to text.

delimiter

An array of string specifying the delimiters to be used to split the content for comparison. This parameter is optional.

If content_type is text and delimiter is not specified, the delimiter is set by default to char(13) (or \n, a carriage return).

If content_type is html and delimiter is not specified, the delimiter array is populated by default with the following values:

["</p>", "</br>", "</h1>", "</h2>", "</h3>", "</h4>", "</h5>", "</h6>", "</div>", "</address>", "</pre>", "</br>", "</tr>", "</caption>", "</blockquote>"]

Returns

An array of array of any.

Example

This example shows a comparison of two text strings. The variable &NewText contains the following string:

Line 2.
Line 2.1.
Line 2.2.
Line 3.
Line 5.
Line 6.
Line 8.

The variable &OldText contains the following string:

Line 1.
Line 2.
Line 3.
Line 4.
Line 7.

The following PeopleCode statement compares the two ASCII-formatted text strings, &NewText and &OldText:

&Output = CompareTextDiff(&NewText, &OldText, "text");

The string variable &Output contains the following array:

0, 1, 0, DELETED, Line 1.
1, 2, 0, COMMON, Line 2.
2, 2, 1, ADD, Line 2.1.
3, 2, 2, ADD, Line 2.2.
4, 3, 0, COMMON, Line 3.
5, 4, 0, CHANGED, Line 5.
6, 5, 0, CHANGED, Line 6.
7, 5, 1, ADD, Line 8.

Syntax

Component  data_type &var_name

Description

Use the Component statement to declare PeopleCode component variables. A component variable, after being declared in any PeopleCode program, remains in scope throughout the life of the component.

The variable must be declared with the Component statement in every PeopleCode program in which it is used.

Declarations appear at the beginning of the program, intermixed with function declarations.

Note: Because a function can be called from anywhere, you cannot declare any component variables within a function. You receive a design time error if you try.

The system automatically initializes temporary variables. Declared variables always have values appropriate to their declared type. Undeclared variables are initialized as null strings.

Not all PeopleCode data types can be declared as Component.

Parameters

Field or Control

Definition

data_type

Specify a PeopleCode data type.

&var_name

A legal variable name.

Example

Component string &PG_FIRST;

Syntax

ComponentChanged()

Description

Use the ComponentChanged function to determine whether a component has changed since the last save, whether by the user or by PeopleCode.

Returns

Returns a Boolean value: True if the component has changed.

Example

If ComponentChanged() Then
   /* do some stuff */
End-if;

Syntax

ConfigureClassicPlusComponent(component_name, market, enable_disable_value)

Description

Use the ConfigureClassicPlusComponent function to apply the classic plus theme to a component.

Parameters

Field or Control

Definition

component_name

Specifies a string value representing the component.

market

Specifies a string value representing the market associated with the component.

Enable_Disable_value

Specifies an integer value - 1 to enable classic plus theme; 0 to disable classic plus theme.

Returns

A Boolean value. True if the classic plus theme is applied successfully to the component; False otherwise.

Example

If ConfigureClassicPlusComponent("USERMAINT_SELF", "GBL", 1) Then
	MessageBox(%MsgStyle_OK, "", 0, 0, "Classic Plus is enabled for this component");
Else
	MessageBox(%MsgStyle_OK, "", 0, 0, "Error: ConfigureClassicPlusComponent()returned failure");
End-If;

Syntax

ConfigureClassicPlusForWC(portal_name, CREF_name, enable_disable_value)

Description

Use the ConfigureClassicPlusForWC function to enable or disable the classic plus theme on a WorkCenter.

Parameters

Field or Control

Definition

portal_name

Specifies a string value representing the portal name.

CREF_name

Specifies a string value representing the WorkCenter using its content reference ID (also referred to as its portal object name).

enable_disable_value

Specifies an integer value - 1 to enable classic plus theme; 0 to disable classic plus theme.

Returns

A Boolean value. True if the classic plus theme is applied successfully to the WorkCenter; False otherwise.

Example

If ConfigureClassicPlusForWC("EMPLOYEE", "IB_MAP_WRKCNTR", 1) Then
	MessageBox(%MsgStyle_OK, "", 0, 0, "Classic Plus is enabled for this WorkCenter");
Else
	MessageBox(%MsgStyle_OK, "", 0, 0, "Error: ConfigureClassicPlusForWC() returned failure");
End-If;

Syntax

ConnectorRequest(&Message)

Description

Use the ConnectorRequest function to send data to the connector using a message, when the connector properties are assigned in the message.

Note: This function has been deprecated and remains for backward compatibility only. Use the IntBroker class ConnectorRequest method instead.

In general, you would build a message, add the specific connector properties, then use ConnectorRequest.

You do not need to set up any transaction or relationship when you use this function. It is a direct call to the gateway.

The response to the message is returned as a nonrowset-based message. Use the GetXmlDoc message class method to retrieve the content data. The data is wrapped in the CDATA tag.

Related Links

ConnectorRequest

Parameters

Field or Control

Definition

&Message

Specify an already instantiated message.

Returns

A nonrowset-based message object.

Syntax

ConnectorRequestURL(ConnectorStringURL)

Description

Use the ConnectorRequestURL function to go directly to the gateway for accessing information.

Note: This function has been deprecated and remains for backward compatibility only. Use the IntBroker class ConnectorRequestURL method instead.

Related Links

ConnectorRequestUrl

Parameters

Field or Control

Definition

ConnectorStringURL

Specify the URL of the gateway as a string. This is a fully formed URL.

Returns

A string containing the URL information returned from the message.

Example

The following is the type of URL that could be returned if you were trying to get a PSFT stock quote:

 http://finance.yahoo.com/d/quotes.txt/?symbols=PSFT&format=l1c1d1t1

Syntax

ContainsCharType(source_str, char_code) 

Description

Use the ContainsCharType function to determine if any of the characters in source_str are of type char_code. The char_code is a numerical value representing a character type (see the following Parameters section for details). Most character types supported by this function equate to specific Unicode character blocks or are based on Unicode character properties.

Parameters

Field or Control

Definition

source_str

String to be examined.

char_code

A number value representing the character type to be tested for. The following table shows valid values. You can specify either a character code numeric value or a constant:

Numeric Value

Constant

Character Set

0

%CharType_AlphaNumeric

Basic Latin — Alphanumeric (printable range of 7-bit US-ASCII), Unicode characters in the range U+0020 — U+007E

1

%CharType_ExtendedLatin1

Extended Latin-1 characters (ISO 8859-1 accents for Western European languages), Unicode characters in the range U+00BF — U+07E

2

%CharType_HankakuKatakana

Hankaku Katakana (half-width Japanese Katakana)

3

%CharType_ZenkakuKatakana

Zenkaku Katakana (full-width Japanese Katakana)

4

%CharType_Hiragana

Hiragana (Japanese)

5

%CharType_Kanji

Chinese, Japanese and Korean ideographic characters. Includes Japanese Kanji, Chinese Hanzi and Korean Hancha.

6

%CharType_DBAlphaNumeric

Full-width Latin Alphanumeric characters, primarily used for Japanese. Excludes

7

None

Korean Hangul syllables, excluding Hangul Jamo.

8,9

None

Reserved for future use.

10

%CharType_JapanesePunctuation

Full- and half-width punctuation, including space (U+0020) and Fullwidth / Ideographic Space (U+3000).

11

None

Greek

12

None

Cyrillic

13

None

Armenian

14

None

Hebrew

15

None

Arabic

16

None

Devanagari

17

None

Bengali

18

None

Gurmukhi

19

None

Gujarati

20

None

Oriya

21

None

Tamil

22

None

Telugu

23

None

Kannada

24

None

Malayalam

25

None

Thai

26

None

Lao

27

None

Tibetan

28

None

Georgian

29

None

Bopomofo

Returns

ContainsCharType returns one of the following Number values. You can check for the constant instead of the numeric value if you prefer:

Numeric Value

Constant Value

Description

1

%CharType_Matched

String contains at least one character of set char_code.

0

%CharType_NotMatched

String contains no characters of set char_code.

-1

%CharType_Unknown

UNKNOWN: unable to determine whether character is of set char_code. This occurs if the character being checked is an unallocated Unicode codepoint, or was added in a version of Unicode greater than that supported by PeopleTools.

Example

This example tests to see if the string contains any Hiragana:

&ANYHIRAGANA = ContainsCharType(&STRTOTEST, 4); 
If &ANYHIRAGANA = 1 Then 
   WinMessage("There are Hiragana characters"); 
Else 
   If &ANYHIRAGANA = 0 Then 
      WinMessage("There are no Hiragana characters"); 
   Else 
      WinMessage("UNKNOWN"); 
   End-If; 
End-If;

Syntax

ContainsOnlyCharType(source_str, char_code_list)

Where char_code_list is a list of character set codes in the form:

char_code_1 [, char_code_2]. . .

Description

Use the ContainsOnlyCharType function to determine whether every character in source_str belongs to one or more of the character types in char_code_list. See the following Parameters section for a list of valid character code values. Most character types supported by this function equate to specific Unicode character blocks or are based on Unicode character properties.

Parameters

Field or Control

Definition

Source_str

String to be examined.

char_code_list

A comma-separated list of character set codes.

char_code_n

Either a Number value identifying a character set, or a constant. The following table shows valid values. You can specify either a character code numeric value or a constant:

Numeric Value

Constant

Character Set

0

%CharType_AlphaNumeric

Alphanumeric (7-bit ASCII codes; A-Z, a-z, 1-9, punctuation)

1

%CharType_ExtendedLatin1

Extended Latin-1 characters (ISO8859-1 accents for Spanish, French, etc.)

2

%CharType_HankakuKatakana

Hankaku Katakana (single-byte Japanese Katakana)

3

%CharType_ZenkakuKatakana

Zenkaku Katakana (double-byte Japanese Katakana)

4

%CharType_Hiragana

Hiragana (Japanese)

5

%CharType_Kanji

Kanji (Japanese)

6

%CharType_DBAlphaNumeric

Double-byte Alphanumeric (Japanese)

7,8,9

 

Reserved for future use

10

%CharType_JapanesePunctuation

Japanese punctuation

Returns

ContainsOnlyCharType returns one of the following Number values. You can check for the constant instead of the numeric value, if you prefer:

Numeric Value

Constant Value

Description

1

%CharType_Matched

String contains only characters belonging to the sets listed in char_code_list.

0

%CharType_NotMatched

String contains one or more characters that do not belong to sets listed in char_code_list.

-1

%CharType_Unknown

UNKNOWN: unable to determine whether character is of set char_code. This occurs if the character being checked is an unallocated Unicode codepoint, or was added in a version of Unicode greater than that supported by PeopleTools.

Note: If any character in the string is determined to be UNKNOWN, the return value is UNKNOWN.

Example

This example tests to see is the string is only Hiragana or Punctuation:

&ONLYHIRAGANA = ContainsOnlyCharType(&STRTOTEST, 4, 10); 
If &ONLYHIRAGANA = 1 Then 
   WinMessage("There are only Hiragana and Punctuation characters"); 
Else 
   If &ONLYHIRAGANA = 0 Then 
      WinMessage("Mixed characters"); 
   Else 
      WinMessage("UNKNOWN"); 
   End-If 
End-If

Syntax

Continue

Description

Use the Continue statement to continue execution in a loop. How the statement performs depends on the type of loop:

  • In For loops, this statement continues to do the next step of the iteration

  • In While loops, this statement continues to the top of the loop and the test of the condition

  • In Repeat-Until loops, this statement continues to the Until check at the bottom of the loop.

Parameters

None.

Example

The following are tests of the continue statement in various types of loops:

SetTracePC(%TracePC_List);
/* tests of continue statement */
&N = 0;
For &I = 1 To 10;
   
   If &I > 5 Then
      Continue;
   End-If;
   &J = &I + 1;
   &K = 0;
   /* now a while loop in here */
   While &J <= 10;
      &J = &J + 1;
      If &J = 7 Then
         Continue;
      End-If;
      For &A = 0 To 5;
         &K = &K + 2;
      End-For; /* no continue statement */
      &Barf = 2;
      Repeat
         &Barf = &Barf;
         If &Barf = 1 Then
            Continue;
         End-If;
      Until &Barf = &Barf;
      &K = &K + 1;
   End-While;
   MessageBox(0, "", 0, 0, "K=" | &K);
   If &I < 2 Then
      Continue;
   End-If;
   &N = &N + 1;
End-For;
MessageBox(0, "", 0, 0, "N=" | &N);

Syntax

ConvertChar(source_str, source_str_category, output_str, target_char_code) 

Description

Use the ConvertChar function to convert every character in source_str to type target_char_code, if possible, and place the converted string in output_str. ConvertChar supports the following conversions:

  • Conversion among Japanese Hankaku (half-width) Katakana, Zenkaku (full-width) Katakana, and Hiragana .

  • Conversion of Japanese Hankaku (half-width) Katakana, Zenkaku (full-width) Katakana, and Hiragana to Hepburn Romaji (Latin representation).

  • Conversion of full-width alphanumeric characters to their half-width equivalents.

  • Conversion of full-width punctuation characters to their half-width equivalents.

Other source_str and target_char_code combinations are either passed through without conversion, or not supported. Character types 0 and 1 (alphanumeric and extended Latin-1) are always passed through to output_str without conversion. See the Supported Conventions section later in this reference entry for details.

If ConvertChar is unable to determine whether the characters in source_str belong to the specified character set, the function returns a value of UNKNOWN (-1). If source_str can be partially converted, ConvertChar will partially convert string, echo the remaining characters to the output string as-is, and return a value of -2 (Completed with Issues).

Parameters

Field or Control

Definition

Source_str

String to be converted.

Source_str_category

Language category of input string. You can specify either a number or a constant.

Numeric Value

Constant Value

Description

0

%ConvertChar_AlphaNumeric

Half-width AlphaNumeric

1

%ConvertChar_ExtendedLatin1

Extended Latin-1 Characters (ISO8859-1 accents, Spanish, French etc.)

2

%ConvertChar_Japanese

Japanese (any)

Field or Control

Definition

Output_str

A String variable to receive the converted string.

Target_char_code

Either a Number or a constant representing the conversion target character type. You can specify either a character code numeric value or a constant:

Numeric Value

Constant Value

Description

0

%CharType_AlphaNumeric

Half-width AlphaNumeric — results in a Hepburn Romaji conversion when the input string contains Hiragana or Katakana

2

%CharType_HankakuKatakana

Hankaku Katakana (half—width Japanese Katakana)

3

%CharType_ZenkakuKatakana

Zenkaku Katakana (full-width Japanese Katakana)

4

%CharType_Hiragana

Hiragana (Japanese)

6

%CharType_DBAlphaNumeric

Full-width AlphaNumeric (Japanese)

The following target values are not supported; if the source string is of the same type as any of these values, then the string is passed through without conversion.

Numeric Value

Constant Value

Description

1

%CharType_ExtendedLatin1

Extended Latin-1 characters (ISO8859-1 accents for Spanish, French, etc.)

5

%CharType_Kanji

Chinese, Japanese and Korean ideographic characters.

10

%CharType_JapanesePunctuation

Full- and half-width punctuation, including space (U+0020) and Fullwidth / Ideographic Space (U+3000).

Supported Conversions

The following table shows which conversions are supported, which are passed through without conversion, and which are not supported:

Source

Target

Conversion

0 (Alphanumeric US-ASCII)

0-6 (All supported character types)

Pass through without conversion

1 (Extended Latin-1 characters)

0-6 (All supported character sets)

Pass through without conversion

2 (Hankaku Katakana)

0 (Alphanumeric — Hepburn romaji)

Conversion supported

1 (Extended Latin)

Not supported

2 (Hankaku Katakana)

Pass through without conversion

3 (Zenkaku Katakana)

Conversion supported

4 (Hiragana)

Conversion supported

5 (Kanji)

Not supported

6 (Full-width alphanumeric)

Not supported

3 (Zenkaku Katakana)

0 (Alphanumeric)

Conversion supported

1 (Extended Latin)

Not supported

2 (Hankaku Katakana)

Conversion supported

3 (Zenkaku Katakana)

Pass through without conversion

4 (Hiragana)

Conversion supported

5 (Kanji)

Not supported

6 (Full-width alphanumeric)

Not supported

4 (Hiragana)

0 (Alphanumeric- Hepburn Romaji)

Conversion supported

1 (Extended Latin)

Not supported

2 (Hankaku Katakana)

Conversion supported

3 (Zenkaku Katakana)

Conversion supported

4 (Hiragana)

Pass through without conversion

5 (Kanji)

Not supported

6 (Full-width alphanumeric)

Not supported

5 (Kanji)

0-4, 6

Not supported

5 (Kanji)

Pass through without conversion

6 (Full-width alphanumeric)

0 (Alphanumeric)

Conversion supported

1-5

Not supported

6 (Full-width alphanumeric)

Pass through without conversion

10 (Japanese punctuation)

0 (Alphanumeric)

Conversion supported

1 (Extended Latin)

Not supported

3-6, 10

Pass through without conversion

Returns

Returns either a Number or a constant with one of the following values, depending on what you’re checking for:

Numeric Value

Constant Value

Description

1

%ConvertChar_Success

String successfully converted.

0

%ConvertChar_NotConverted

String not converted.

-1

%ConvertChar_Unknown

UNKNOWN: unable to determine whether character is of set char_code. This occurs if the character being checked is an unallocated Unicode codepoint, or was added in a version of Unicode greater than that supported by PeopleTools.

-2

%ConvertChar_Issues

Completed with issues. Conversion executed but there were one or more characters encountered that were either not recognized, or whose conversion is not supported.

Note: If any character cannot be translated, it is echoed as-is to output_str. output_str could therefore be a mixture of converted and non-converted characters.

Example

This example attempts to convert a string to Hiragana:

&RETVALUE = ConvertChar(&INSTR, 2, &OUTSTR, 4); 
If &RETVALUE = 1 Then 
   WinMessage("Conversion to Hiragana successful"); 
Else 
   If &RETVALUE = 0 Then 
      WinMessage("Conversion to Hiragana failed"); 
   Else 
      If &RETVALUE = - 1 Then 
         WinMessage("Input string is UNKNOWN character type."); 
      Else 
         WinMessage("Some characters could not be converted."); 
      End-If 
   End-If 
End-If

Syntax

ConvertCurrency(amt, currency_cd, exchng_to_currency, exchng_rt_type, effdt, converted_amt [, error_process [, round] [, rt_index]])

Description

Use the ConvertCurrency function to convert between currencies. The result of the conversion is placed in a variable passed in converted_amt.

Parameters

Field or Control

Definition

Amt

The currency amount to be converted.

Currency_cd

The currency in which the amt is currently expressed.

Exchng_to_currency

The currency to which the amt should be converted.

Exchng_rt_type

The currency exchange rate to be used. This is the value of the RT_TYPE field in the RT_RATE table of RT_DFLT_VW.

Effdt

The effective date of the conversion to be used.

Converted_amt

The resulting converted amount. You must supply a variable for this parameter. If a conversion rate cannot be found, converted_amt is set equal to amt.

Error_process

An optional string that, if specified, contains one of the following values:

  • "F" - Produce a fatal error if a matching conversion rate is not found.

  • "W" - Produce a warning message box if a matching conversion rate is not found.

  • "I" - Or other−return without producing a message box

If error_process is not specified, it defaults to Fatal ("F").

Round

Optional Boolean value indicating whether to round converted_amt to the smallest currency unit. If omitted, round defaults to False.

rt_index

An optional string to indicate which exchange rate index should be used to retrieve the exchange rate. If omitted, the Default Exchange Rate index (as specified on the Market Rate index definition) is used.

Note: If the currency exchange rate is changed in a PeopleSoft table, this change will not be reflected in an already open page until the user closes the page, then opens it again.

Returns

ConvertCurrency returns a Boolean value where True means a conversion rate was found and converted_amt calculated, and False means a conversion rate was not found and a value of one (1) was used.

Example

rem **-----------------------------------------------**; 
rem *  Convert the cost & accum_depr fields if books *; 
rem * use different currencies.  *; 
rem **-----------------------------------------------**; 
rem; 
   If &FROM_CUR <> &PROFILE_CUR_CD Then 
      &CON_COST_FROM = &COST_COST; 
      &CON_ACC_DEPR_FROM = &COST_ACCUM; 
      ConvertCurrency(&CON_COST_FROM, &FROM_CUR, &PROFILE_CUR_CD, RT_TYPE,TRANS_DT, &CON_COST_TO, "F"); 
      UpdateValue(COST_NON_CAP.COST, &COST_ROW_CUR, &CON_COST_TO); 
   Else 
      UpdateValue(COST_NON_CAP.COST, &COST_ROW_CUR, &COST_COST); 
   End-If; 
   UpdateValue(COST_NON_CAP.FROM_CUR, &COST_ROW_CUR, &PROFILE_CUR_CD); 
UpdateValue(COST_NON_CAP.OPRID, &COST_ROW_CUR, %UserIdId);

Syntax

ConvertDatetimeToBase(textdatetime, {timezone | "Local" | "Base"})

Description

Use the ConvertDatetimeToBase function to convert the text value textdatetime to a DateTime value. The ConvertDatetimeToBase function then further converts it from the specified time zone to the base time zone. This function automatically calculates whether daylight saving time is in effect for the given textdatetime and time zone.

The system’s base time zone is specified in the PSOPTIONS table.

Parameters

Field or Control

Definition

textdatetime

Specify a date/time represented as text in the PeopleSoft internal format: yyyy-mm-dd hh:mm:ss[.S] (for example, "2011-01-01 18:10:52.000000").

In which:

  • yyyy is a four-digit year.

  • mm is a two-digit month (01 through 12).

  • dd is a two-digit day of the month (01 through 31).

  • hh is a two digits of hour (00 through 23).

  • mm is a two digits of minute (00 through 59).

  • ss is two digits of second (00 through 59).

  • S is milliseconds in one or up to six digits.

timezone | Local | Base

Specify a value for converting textdatetime. Values are:

  • timezone - a time zone abbreviation or a field reference to be used for converting textdatetime

  • Local - use the local time zone for converting textdatetime.

  • Base - use the base time zone for converting textdatetime.

Returns

Returns a DateTime value in the base time zone.

Example

In the following example, assuming the base time (as defined in PSOPTIONS) is PST, &DATETIMEVAL would have a DateTime value of "1999-01-01 07:00:00.000000":

&DATETIMEVAL= ConvertDateTimeToBase("1999-01-01 10:00:00.000000", "EST");

Syntax

ConvertRate(Rate, In_Frequency, Out_Frequency)

Description

Use the ConvertRate function to convert a rate between various compounding frequencies.

Parameters

Field or Control

Definition

Rate

The rate to be converted. This parameter takes a number value.

In_Frequency

The frequency of the rate to be converted from. This parameter takes an array of number, with two elements. The first element is periodicity, (for example, if you chose daily compounding, 1 would represent daily while 7 would represent weekly.) The second element is the unit of measure of frequency. The values for the second element are:

Value

Description

0

continuous compounding

1

daily compounding

2

monthly compounding

3

yearly compounding

Field or Control

Definition

Out_Frequency

The frequency of the rate to be converted to. This parameter takes an array of number, with two elements. The first element is periodicity, (for example, if you chose daily compounding, 1 would represent daily while 7 would represent weekly.) The second element is the unit of measure of frequency. The values for the second element are:

Value

Description

0

continuous compounding

1

daily compounding

2

monthly compounding

3

yearly compounding

Returns

A number representing the converted rate.

Example

The following example converts the specified values from days to years.

Local array of number &In, &Out; 
Local number &rate, &NewRate; 
 
&rate = 0.01891; 
&In = CreateArray(0, 0); 
&In[1] = 1; /* daily */ 
&In[2] = 1; /* compound_days */ 
&Out = CreateArray(0, 0); 
&Out[1] = 1; /* one year */ 
&Out[2] = 3; /* compound_years */ 
 
&NewRate = ConvertRate(&rate, &In, &Out);

Syntax

ConvertTimeToBase(texttime,{timezone | "Local" | "Base"})

Description

Use the ConvertTimeToBase function to convert the text value texttime to a Time value and converts it to the base time. This function automatically calculates whether daylight saving time is in effect for the given texttime.

This function is useful for users to convert constant times in specific time zones into database time. For example, there is a deadline for completing Federal Funds transfers by 3:00 PM Eastern Time. ConvertTimeToBase does this conversion, taking into account daylight saving time. The date used to calculate whether daylight saving time is in effect is the current date.

The system’s base time zone is specified on the PSOPTIONS table.

Parameters

Field or Control

Definition

texttime

Specify a time value represented as text (e.g., "3:00 PM")

timezone | Local | Base

Specify a value for converting texttime. Values are:

  • timezone - a time zone abbreviation or a field reference to be used for converting texttime

  • Local - use the local time zone for converting texttime.

  • Base - use the base time zone for converting texttime.

Returns

Returns a time value in the base time zone.

Example

In the following example, &TIMEVAL would have a time value of "07:00:00.000000", assuming the Base time (as defined in PSOPTIONS) was PST.

&TEXTTIME = ConvertTimeToBase("01/01/99 10:00:00AM", "EST");

Syntax

CopyAttachments(URLSource, URLDestination [, FileRefRecords [, PreserveCase[, AllowLargeChunks]]])

Description

Use the CopyAttachments function to copy all files from one storage location to another. The files to be copied can be limited to those referenced in specific file reference tables.

To schedule a batch job to copy file attachments, you can use the COPYATTS Application Engine program, which can be executed from the Copy File Attachments (Batch) page. See Copy File Attachments (Batch) for more information.

Alternatively, you can use the Manage Attachment Repositories page to execute CopyAttachments directly in a synchronous manner. See Manage Attachment Repositories for more information.

Important! Executing CopyAttachments directly in a synchronous manner may result in a timeout if the number of file attachments to be processed is large. Therefore, Oracle recommends that you use the batch processing interface instead.

CopyAttachments looks for the field ATTACHSYSFILENAME in the table that stores the file references. Oracle recommends that you include the FILE_ATTACH_SBR subrecord, which includes the ATTACHSYSFILENAME and ATTACHUSERFILE fields, in your record definition, not just the fields themselves.

CopyAttachments generates a list of all file attachments references, and then performs two operations on each file attachment. First, CopyAttachments calls GetAttachment to retrieve the file from your source location. Then, it calls PutAttachment to copy the attachment to your destination.

Note: If the specified subdirectories do not exist this function tries to create them.

PeopleTools supports multiple types of storage locations. Additional information on using CopyAttachments with storage locations can be found in the PeopleTools: PeopleCode Developer's Guide:

See Understanding File Attachment Storage Locations.

Considerations on Using PreserveCase with CopyAttachments

If the files to be copied were originally uploaded with the value of the PreserveCase optional parameter unspecified or explicitly specified as False, then CopyAttachments should be similarly invoked (with the value of PreserveCase unspecified or explicitly specified as False). On the other hand, if the files to be copied were originally uploaded with the value of the PreserveCase explicitly specified as True, then CopyAttachments should be similarly invoked (with the value of PreserveCase explicitly specified as True). If the files to be copied fall into both categories, then CopyAttachment will need to be run twice , once with the value of PreserveCase unspecified or explicitly specified as False, and then again with the value of PreserveCase explicitly specified as True.

Parameters

Field or Control

Definition

URLSource

Specify the source storage location of the files to be copied. This parameter can either be a URL identifier in the form URL .URL_ID, or a string.

Note: When the URLSource parameter is specified as a string value, forward slashes (/) are required. Backward slashes (\) are not supported for a string value.

See Understanding URL Strings Versus URL Objects.

URLDestination

Specify the destination storage location for the files to be copied. This parameter can either be a URL identifier in the form URL.URL_ID, or a string.

Note: When the URLDestination parameter is specified as a string value, forward slashes (/) are required. Backward slashes (\) are not supported for a string value.

See Understanding URL Strings Versus URL Objects.

FileRefRecords

Specify an array of record names each of which is associated with a table containing valid file references. By using this parameter, it is possible to explicitly specify which groups of file references will be considered during a call to CopyAttachments and, in this way, further restrict the scope of that call. If you do not specify this optional parameter, all the records that contain the FILE_ATTACH_SBR subrecord will be considered to have been implicitly specified (that is, every file at the specified source storage location that has some valid corresponding file reference will be copied).

Note: If you want to specify the PreserveCase parameter, the AllowLargeChunks parameter, or both and retain the default behavior of copying from all the records that contain the FILE_ATTACH_SBR subrecord, then specify an empty array as the value of the FileRefRecords parameter.

PreserveCase

Specify a Boolean value to indicate whether, when searching the source storage locations for the file specified by each file reference and when naming that file at the destination, its file name extension will be preserved or not; True, preserve the case of the file name extension, False, convert the file name extension to all lower case letters.

The default value is False.

Warning! If you use the PreserveCase parameter, it is important that you use it in a consistent manner with all the relevant file-processing functions or you may encounter unexpected file-not-found errors.

AllowLargeChunks

Specify a Boolean value to indicate whether to allow large chunks.

If the value specified in the Maximum Attachment Chunk Size field on the PeopleTools Options page is larger than is allowed for retrieval, then the system breaks the file upload into the largest sized chunks allowed. If AllowLargeChunks is set to True, this behavior can be overridden so that it is possible for an end user to upload a file in chunks that are too large for the system to retrieve. If AllowLargeChunks is set to False, the system will use the largest size chunk that is allowed for retrieval, or the configured chunk size, whichever is smaller.

Note: If the chunks are too big to be retrieved, then any file retrieval built-in function, such as GetAttachment, will fail.

Note: The AllowLargeChunks parameter is only applicable when the storage location is a database record. It has no impact when the storage location is an FTP site or an HTTP repository, since attachments at those locations are never chunked.

See PeopleTools Options

This is an optional parameter.

The default value is False.

Returns

You can check for either an integer or a constant value:

Note: Since file attachment references might not always point to real files in your source location (they might point to files in other locations, for example), file not found errors from the GetAttachment operation are ignored and not included in the CopyAttachments return code.

Note: Because CopyAttachments is designed to work with multiple files, to track errors when using CopyAttachments set your PeopleCode trace to 2112 and your SQL trace to 15 so that errors will be written to the appropriate trace files.

Numeric Value

Constant Value

Description

0

%Attachment_Success

Files were copied successfully.

1

%Attachment_Failed

File copy failed due to an unspecified error.

The following are some possible situations where %Attachment_Failed could be returned:

  • Failed to initialize the process due to some internal error.

  • Failed due to unexpected/bad reply from server.

  • Failed to allocate memory due to some internal error.

  • Failed due to timeout.

  • Failed due to non-availability of space on FTP server.

  • Failed to close SSL connection.

  • Failed due to an unspecified error on the HTTP repository.

    If the HTTP repository resides on a PeopleSoft web server, then you can configure tracing on the web server to report additional error details.

    See Enabling Tracing on the Web Server or Application Server.

3

%Attachment_FileTransferFailed

File copy failed due to an unspecified error during FTP attempt.

The following are some possible situations where %Attachment_FileTransferFailed could be returned:

  • Failed due to mismatch in file sizes.

  • Failed to write to local file.

  • Failed to store the file on remote server.

  • Failed to read local file to be uploaded

  • No response from server.

  • Failed to overwrite the file on remote server.

4

%Attachment_NoDiskSpaceAppServ

No disk space on the application server.

7

%Attachment_DestSystNotFound

Cannot locate destination system for FTP.

The following are some possible situations where %Attachment_DestSystNotFound could be returned:

  • Improper URL format.

  • Failed to connect to the server specified.

8

%Attachment_DestSysFailedLogin

Unable to login to destination system for FTP.

The following are some possible situations where %Attachment_DestSysFailedLogin could be returned:

  • Unsupported protocol specified.

  • Access denied to server.

  • Failed to connect using SSL Failed to verify the certificates.

  • Failed due to problem in certificates used.

  • Could not authenticate the peer certificate.

  • Failed to login with specified SSL level.

  • Remote server denied logon.

  • Problem reading SSL certificate.

9

%Attachment_FileNotFound

Cannot locate file.

The following are some possible situations where %Attachment_FileNotFound could be returned:

  • Remote file not found.

  • Failed to read remote file.

Example

&retcode = CopyAttachments(URL.UrlID, ftp://user:passwd@ftpaddress/");

Here is another example.

&aRecs = CreateArray("HRATTS", "MFGATTS", "CRMATTS");  
    
&ret = CopyAttachments("ftp://user:pass@system/HR/", "record://HRARCHIVE", 
&aRecs);  
 
If (&ret = %Attachment_Success) Then 
   MessageBox(0, "Copy Archive Status", 0, 0, "Copy attachment archive succeeded"); 
Else 
   MessageBox(0, "Copy Archive Status", 0, 0, "Copy attachment archive failed"); 
End-If;

If you want to specify the PreserveCase parameter, the AllowLargeChunks parameter, or both and retain the default behavior of copying from all the records that contain the FILE_ATTACH_SBR subrecord, then specify an empty array as the value of the FileRefRecords parameter. For example:

Local string &URL1 = "ftp://my_ftp_user:my_ftp_password@my_ftp_server.example.com";
Local string &URL2 = "record://PSFILE_ATTDET";
Local array of string &FileRefRecords = CreateArrayRept("", 0);
Local boolean &PreserveCase = True;
&ret = CopyAttachments(&URL1, &URL2, &FileRefRecords, &PreserveCase);

Syntax

CopyFields(from, to)

where from and to are constructions that reference rows of data on specific source and target records in the component buffer; each have the following syntax:

level, scrollpath, target_row

and where scrollpath is:

[RECORD.level1_recname, level1_row, [RECORD.level2_recname, level2_row, ]] RECORD.target_recname

To prevent ambiguous references, you can also use SCROLL. scrollname, where scrollname is the same as the scroll level’s primary record name.

Description

Use the CopyFields function to copy like-named fields from a row on the specific source record to a row on the specific target record.

Note: This function remains for backward compatibility only. Use the CopyFieldsTo or CopyChangedFieldsTo record class methods instead.

Parameters

Field or Control

Definition

from

A placeholder for a construction (level, scrollpath, target_row) that references the first row in the comparison.

to

A placeholder for a construction (level, scrollpath, target_row) that references the second row in the comparison.

level

Specifies the scroll level for the target level scroll.

scrollpath

A construction that specifies a scroll level in the component buffer.

target_row

Specifies the row number of each target row on its scroll level.

Returns

Optionally returns a Boolean value indicating whether the function succeeded.

Example

The following example copies fields from PO_RECEIVED_INV (level 1 scroll) from row &ROW to PO_RECV_INV_VW (level 1 scroll), row &LOC_ROW:

CopyFields(1, RECORD.PO_RECEIVED_INV, &ROW, 1, RECORD.PO_RECV_INV_VW, &LOC_ROW);

Syntax

CopyFromJavaArray(JavaArray, &PeopleCodeArray [, &RestrictionArray])

Description

Use the CopyFromJavaArray function to copy the array specified by JavaArray into one-dimensional PeopleCode array &PeopleCodeArray.

Note: The Java array must be at least the same size as the PeopleCode array.

The optional &RestrictionArray parameter is a PeopleCode array that contains the index elements of the elements to copy. For example if &RestrictionArray contains the indexes 3, 5 and 7, only elements 3, 5 and 7 in the PeopleCode array are copied to the Java array, and they are copied to the elements 3, 5 and 7. This allows you to minimize the copying when you have arrays that don’t require a full element by element copy. If &RestrictionArray is not specified, a complete array copy is done.

The array types between the PeopleCode array and the Java array must match the standard type mapping between Java and PeopleCode types. For example, trying to copy a PeopleCode array of Any into a Java array of int will fail because the Any PeopleCode type doesn't map onto the Java int type.

Parameters

Field or Control

Definition

JavaArray

Specify the name of the Java array that you want to copy data from.

&PeopleCodeArray

Specify the name of an already instantiated PeopleCode array that you want to copy the data into.

&RestrictionArray

Specify an already instantiated and populated PeopleCode array that contains the set of elements the copy is restricted to. This array should be of type number.

Returns

None.

Example

Local array of any &x = CreateArrayAny();

&x.Push("First bit");
&x.Push(1);
&x.Push(%Datetime);
&x.Push(%Date);
&x.Push("Final bit");
Local array of number &selection = CreateArray(1, 3, 5);
Local JavaObject &Jarray = CreateJavaArray("java.lang.Object[]", &x.Len);
/* Full copy to a Java array */
CopyToJavaArray(&x, &Jarray);
/* Full copy from Java array to PeopleCode array */
Local array of any &y = CreateArrayAny();
&y [5] = Null; /* make sure it's the right length */
CopyFromJavaArray(&Jarray, &y);

Syntax

CopyRow(destination_row, source_row)

Description

Use the CopyRow function to copy data from one row to another row.

Note: This function remains for backward compatibility only. Use the CopyTo row class method instead.

destination_row is the row number to which you want the source _row data values copied. The two rows, and the PeopleCode function call, must all be located on the same scroll level.

Parameters

Field or Control

Definition

destination_row

Row number of row to which to copy data.

source_row

Row number of row from which to read data.

Example

This example uses CopyRow to give an inserted row the same values as the previous row:

/*  Get the row number of the inserted row and the previous row */
&NEW_ROW_NUM = CurrentRowNumber();
&LAST_ROW_NUM = &NEW_ROW_NUM - 1;
/*  Copy the data from the previous row into the inserted row */
CopyRow(&NEW_ROW_NUM, &LAST_ROW_NUM);

Syntax

CopyToJavaArray(&PeopleCodeArray, JavaArray [, &RestrictionArray])

Description

Use the CopyToJavaArray function to copy the one-dimensional array specified by &PeopleCodeArray into the Java array JavaArray. The Java array must be at least as large as the PeopleCode array.

The optional &RestrictionArray parameter is a PeopleCode array that contains the index elements of the elements to copy. For example if &RestrictionArray contains the indexes 3, 5 and 7, only elements 3, 5 and 7 in the PeopleCode array are copied to the Java array, and they are copied to the elements 3, 5 and 7. This allows you to minimize the copying when you have arrays that don’t require a full element by element copy. If &RestrictionArray is not specified, a complete array copy is done.

The array types between the PeopleCode array and the Java array must match the standard type mapping between Java and PeopleCode types. For example, trying to copy a PeopleCode array of Any into a Java array of int will fail because the Any PeopleCode type doesn't map onto the Java int type.

Parameters

Field or Control

Definition

&PeopleCodeArray

Specify an already instantiated and populated one-dimentional PeopleCode array that contains the information you want to copy to a Java array.

JavaArray

Specify the Java array that you want to copy information into.

&RestrictionArray

Specify an already instantiated and populated PeopleCode array that contains the set of elements the copy is restricted to. This array should be of type number.

Returns

None.

Example

The following example creates an array, then shows both copying the full array, as well as only copying elements of it.

Local array of any &x = CreateArrayAny();

&x.Push("First bit");
&x.Push(1);
&x.Push(%Datetime);
&x.Push(%Date);
&x.Push("Final bit");

Local array of number &selection = CreateArray(1, 3, 5);

Local JavaObject &Jarray = CreateJavaArray("java.lang.Object[]", &x.Len);

/* Full copy to a Java array */
CopyToJavaArray(&x, &Jarray);

/* Only copy elements 1, 3 and 5 */
CopyToJavaArray(&x, &Jarray, &selection);

Syntax

Cos(angle)

Description

Use the Cos function to calculate the cosine of the given angle (adjacent / hypotenuse).

Parameters

Field or Control

Definition

angle

A value in radians.

Returns

A real number between -1.00 and 1.00.

Example

The following example returns the cosine of an angle measuring 1.2 radians:

&MY_RESULT = Cos(1.2);

Syntax

Cot(angle)

Description

Use the Cot function to calculate the cotangent of the given angle (adjacent / opposite, that is, the reciprocal of the tangent).

Parameters

Field or Control

Definition

angle

A value in radians, excluding 0. If the input value is 0, you receive an error message at runtime (“Decimal arithmetic error occurred. (2,110)”). Adjust your code to provide a valid input value.

Note: In theory, all values of angle such that mod(angle, pi) equals 0 are not valid for this function, because inputs approaching such values produce results that tend toward infinity. In practice, however, no computer system can represent such values exactly. Thus, for example, the statement Cot(Radians(180)) produces a number close to the largest value PeopleCode can represent, rather than an error.

Returns

A real number.

Example

The following example returns the cotangent of an angle measuring 1.2 radians:

&MY_RESULT = Cot(1.2);

Syntax

create PKG_NAME[:SubpackageName[:SubpackageName]]{:ClassName([paramlist])

Description

Use the create function to instantiate an object of the specified application class.

Because the object’s constructor method is automatically invoked by the create function, any parameters needed by the constructor method must be included in the invocation of create.

Parameters

Field or Control

Definition

PKG_NAME

Specify the name of the package that contains the class.

:SubpackageName[:SubpackageName]

Specify the subpackage path to the class.

ClassName

Specify the class that defines the object to be instantiated.

paramlist

Specify the parameters required by the object’s constructor method.

Returns

An object of the specified application class.

Example 1

The following example simultaneously declares and instantiates a SearchFactory object:

import PT_SEARCH:SearchFactory;

Local PT_SEARCH:SearchFactory &factory = create PT_SEARCH:SearchFactory();

Example 2

In the following example, the constructor method of the Privilege class requires the list ID as an input parameter. Therefore, the parameter must be supplied in the invocation of create:

import PTAI_ACTION_ITEMS:*;

Component PTAI_ACTION_ITEMS:Privilege &privileges;

&privileges = create PTAI_ACTION_ITEMS:Privilege(&ListId);

----------------------------------------------------------
class Privilege
   method Privilege(&newListId As string);
   
   ...
   
end-class;

Syntax

CreateAnalyticInstance(AnalyticType, ID, Descr, &RecordRef, ForceDelete)

Description

Use the CreateAnalyticInstance function to create an analytic instance as identified by the analytic ID. If ID is an empty string, the system automatically generates a unique ID.

This function only creates the metadata for the ID. It doesn't load the instance into an analytic server.

If this analytic instance already exists in the system, and you specify ForceDelete as false, the analytic instance is not created. If you specify ForceDelete as true, the existing analytic instance is deleted and the new one is created.

Every analytic type definition is defined with an application package that contains three methods: Create, Delete, and Copy. The values in &RecordRef are passed to the Create method.

Parameters

Field or Control

Definition

AnalyticType

Specify the name of the analytic type definition to be used.

ID

Specify the analytic instance identifier as a string. This parameter must be 20 characters or less.

Descr

Specify a description for this analytic instance as a string.

&RecordRef

Specify an already instantiated record object to pass values to the application package Create method that's associated with the analytic type definition. If you do not want to specify a record, you can specify NULL.

ForceDelete

Specify the behavior if the specified analytic ID already exists. This parameter takes a boolean value. If ForceDelete is set to false and the specified ID exists, this function terminates without creating a new analytic instance. If ForceDelete is set to true and the specified ID exists, the analytic instance is deleted and then recreated.

Returns

An AnalyticInstance object if successful, null otherwise.

Example

Local AnalyticInstance &pi; 

/* Create a brand new analytic instance */ 
&pi = CreateAnalyticInstance("BusinessPlanning", "Test", "PopulateTables", &argrec, True);

Syntax

CreateArray(paramlist)

Where paramlist is an arbitrary-length list of values in the form:

param1 [, param2] ...

Description

Use the CreateArray function to construct an array and returns a reference to it.

The type of the first parameter determines the type of array that is built. That is, if the first parameter is of type NUMBER, an array of number is built. If there is no first parameter an empty array of ANY is built.

The CreateArray function uses flattening and promotion as required to convert subsequent values into suitable elements of the array.

Parameters

Field or Control

Definition

paramlist

Specify a list of values to be used as the elements of the array.

Returns

Returns a reference to the array.

Example

Local Array of Array of Number &AAN; 
Local Array of Number &AN; 
 
&AAN = CreateArray(CreateArray(1, 2), CreateArray(3, 4), 5); 
&AN = CreateArray(6, &AAN[1]);

&AAN is a two dimensional array with three elements:

  • A one-dimensional array with 1 and 2 as elements.

  • A one-dimensional array with 3 and 4.

  • A one-dimensional array with only the element 5.

The last parameter to Array was promoted to a one-dimensional array. &AN is a one-dimensional array with 3 elements: 6, 1, and 2. The last parameter to Array in the last line was flattened into its two elements.

Syntax

CreateArrayAny([paramlist])

Where paramlist is an arbitrary-length list of values in the form:

param1 [, param2] ...

Description

Use the CreateArrayAny function to construct an array whose elements are of data type ANY and returns a reference to it.

The CreateArrayAny function uses flattening and promotion as required to convert subsequent values into suitable elements of the array.

If you do not specify any parameters with CreateArrayAny, it's the same as using the CreateArray function without any parameters.

If you do not know how many values are needed in a SQL statement until runtime, you can use an array of any to supply the values.

Parameters

Field or Control

Definition

paramlist

Specify a list of values to be used as the elements of the array.

Returns

Returns a reference to an array of ANY.

Example

local Array of Any &ArrayAny = CreateArrayAny(1, 2, "hi", "there");
local Array of Array of Any &AAAny = CreateArray(CreateArrayAny(1, 2), CreateArrayAny("hi"), "there");

&ArrayAny is a two dimensional array with four elements: 1, 2, "hi" and "there". All the elements have the data type Any.

&AAAny is a two-dimensional array with three elements: a one-dimensional array with 1 and 2 as elements, a one-dimensional array with "hi" as its element, and a one-dimensional array with only the element "there". The last parameter to the array was promoted to a one-dimensional array.

Syntax

CreateArrayRept(val, count)

Description

Use the CreateArrayRept function to create an array that contains count copies of val. If val is itself an array, the created array has one higher dimension, and each element (sub-array) is the array reference val.

The type of the first parameter (val) determines the type of array that is built. That is, if the first parameter is of type NUMBER, an array of number is built. If count is zero, CreateArrayRept creates an empty array, using the val parameter for the type.

If you are making an array that is multi-dimensional, val will be the subarray used as the elements.

To make the subarrays distinct, use the Clone method. For example:

&A = CreateArrayRept(&AN, 4).Clone();

Parameters

Field or Control

Definition

val

A value of any type.

count

The number of copies of val contained in the array.

Returns

Returns a reference to the array.

Example

The following code sets &A to a new empty array of string:

&A = CreateArrayRept("", 0);

The following code sets &A to a new array of ten zeroes:

&A = CreateArrayRept(0, 10);

The following code sets &AAS to a new array of array of strings, with two subarrays:

&AAS = CreateArrayRept(CreateArray("one", "two"), 2);

Note that in this case, both elements (rows) of &AAS contain the same subarray, and changing the value of an element in one of them changes it in both of them. To get distinct subarrays, use the Clone method:

&AAS = CreateArrayRept(CreateArray("one", "two"), 2).Clone();

The following example shows how to create a two-dimension array using CreateArrayRept and Push. In addition, it shows how to randomly assigns values to the cells in a two-dimension array.

Local array of array of string &ValueArray; 
 
&Dim1 = 10; 
&Dim2 = 5; 
&ValueArray = CreateArrayRept(CreateArrayRept("", 0), 0); 
For &I = 1 To &Dim1 
   &ValueArray.Push(CreateArrayRept("", &Dim2)); 
End-For; 
&ValueArray[1][1] = "V11"; 
&ValueArray[2][1] = "V21"; 
 
WinMessage("&ValueArray[1][1] = " | &ValueArray[1][1] | " " | "&ValueArray[2][1] = " | &ValueArray[2][1], 0);

Syntax

CreateBreadcrumb(Back_label, history_ID, portal_ID, node_ID, component, page_ID, page_title, comp_mode [, comp_keys] [, qry_string])

Description

Note: This function has been deprecated and is retained for backward compatibility only.

Use the CreateBreadcrumb function to inject a history record containing application-specific data into the user’s Back button history stack. Optionally, the HTML representing the new history record can be returned as a String value. The result of the function depends on the context from which it is invoked:

  • When navigating to a content reference from the menu, the application-specific history record generated by CreateBreadcrumb is used instead of the history record generated by PeopleTools.

  • If the history record is generated as the result of a related action, the history record generated by CreateBreadcrumb is used instead of the history record generated by the related action.

  • If the generated history record duplicates an existing history record in the history stack (identical history record ID), the original history record is deleted from its position in the list and the generated history record is appended to the end of the list.

  • However, if the history record is generated by a pagelet or tile on a homepage or dashboard, the history stack list is not updated.

Note: This function cannot be invoked from a fluid component. In addition, this function cannot be invoked after the content is displayed via a direct psc URL.

Parameters

Field or Control

Definition

Back_label

Specifies a label for the Back button as a String value.

history_ID

Specifies a unique ID for the history record as a String value.

portal_ID

Specifies the portal to be used to construct the content URL as a String value.

This portal ID can be specified as a literal string, by using the %Portal system variable, or by using the Portal.PORTAL_NAME reserved word.

node_ID

Specifies the portal to be used to construct the content URL as a String value.

This node ID can be specified as a literal string, by using the %Node system variable, or by using the Node.NODE_NAME reserved word.

component

Specifies the component to be used to construct the content URL as a String value. The component parameter is constructed from three values (MENU.COMPONENT.MKT) as follows:

  • MENU: This menu ID can be specified as a literal string, by using the %Menu system variable, or by using the MenuName.MENU_NAME reserved word.

  • COMPONENT: This component ID can be specified as a literal string, by using the %Component system variable, or by using the Component.COMPONENT_NAME reserved word.

  • MKT: This market ID can be specified as a literal string, by using the %Market system variable, or by using the Market.MARKET_NAME reserved word.

page_ID

Specifies the current page in the component as a String value.

This page ID can be specified as a literal string, by using the %Page system variable, or by using the Page.PAGE_NAME reserved word.

page_title

Specifies a title for the page as a String value.

comp_mode

Specifies the mode for the component as a single-character String value. Valid modes are:

  • "A" ( add)

  • "U" (update)

  • "L" (update/display all)

  • "C" (correction)

  • "E" (data entry)

You can also specify a empty string ("") for this value.

comp_keys

Specifies optional component keys and key values to be used to select a unique row at level zero in the current component as a String value. Specify keys and values in the following recommended format:

KEY1_NAME:'KEY1_VALUE';KEY2_NAME:'KEY2_VALUE';...
qry_string

Specifies optional query string parameters to be appended to the content URL as a String value in standard query string format:

param1=value1&param2=value2&...

Returns

(Optional) A String value.

Example

The following PeopleCode program is executed when the user is on the Roles page of the User Profiles component:

&szLabel = "User Profile - Roles";
&szID = "PT_USERMAINT_GBL";
&szPortalID = %Portal;
&szNodeID = %Node;
&szComponentID = %Menu | "." | %Component | "." | %Market;
&szPage = %Page;
&szPageTitle = "Roles - App Back";
&szMode = %Mode;
&szKeys = "OPRID:'PSADMIN'";

Local string &retHTML;

&retHTML = CreateBreadcrumb(&szLabel, &szID, &szPortalID, &szNodeID, &szComponentID, &szPage, &szPageTitle, &szMode, &szKeys);

Then, the following HTML would be returned by this invocation of CreateBreadcrumb:

<li id="pthnavbccref_PT_USERMAINT_GBL" class="pthnavbarcref pthbcdispiblock ptdynnavbc ptappbc"> 
<a id="pthnavbccrefanc_PT_USERMAINT_GBL" class="ptntop" data-ptf-nextid="id" data-ptf-previd="id" role="menuitem" href="url" >User Profile - Roles</a> 
<div class="pthnavcrefimg"> </div> 
<div id="pthnavcrefid_PT_USERMAINT_GBL" style="display:none;">PT_USERMAINT_GBL</div> 
<div id="pthnavportalid_PT_USERMAINT_GBL" style="display:none;">EMPLOYEE</div> 
<div id="pthnavnodeid_PT_USERMAINT_GBL" style="display:none;">QE_LOCAL</div> 
<div id="pthnavcomponentid_PT_USERMAINT_GBL" style="display:none;">MAINTAIN_SECURITY.USERMAINT.GBL</div> 
<div id="pthnavpageid_PT_USERMAINT_GBL" style="display:none;">USER_ROLES</div> 
<div id="pthnavpagetitle_PT_USERMAINT_GBL" style="display:none;">Roles - App Back</div> 
<div id="pthnavcomponentmode_PT_USERMAINT_GBL" style="display:none;">U</div> 
<div id="pthnavcomponentkeys_PT_USERMAINT_GBL" style="display:none;"> OPRID:'PSADMIN'</div> 
<div id="pthnavqs_PT_USERMAINT_GBL" style="display:none;">UnknownValue</div> 
</li>

Syntax

CreateDirectory(path, [, pathtype])

Description

Use the CreateDirectory function to create the directory specified by path and any non-existent directories specified in path.

Important! The CreateDirectory function can be used to create a directory on an existing Windows share—for example, \\my_server\my_share\mydir. However, if the root of a Windows share (for example, \\my_server\my_share) is passed to CreateDirectory, the function will always fail.

On UNIX systems, the directory has the mode 755, that is, read-write-execute permission for the owner, while group and other have only read and execute permission.

drwxr-xr-x

Parameters

Field or Control

Definition

path

Specify the path to be created.

pathtype

Use this parameter to specify whether the path is an absolute or relative path. The valid values for this parameter are:

  • %FilePath_Relative (default)

  • %FilePath_Absolute

If you don’t specify pathtype the default is %FilePath_Relative.

If you specify a relative path, that path is appended to the path constructed from a system-chosen environment variable. A complete discussion of relative paths and environment variables is provided in documentation on the File class.

See Working With Relative Paths.

If the path is an absolute path, whatever path you specify is used verbatim. You must specify a drive letter and the complete path. You can’t use any wildcards when specifying a path.

The Component Processor automatically converts platform-specific separator characters to the appropriate form for where your PeopleCode program is executing. On a Windows system, UNIX "/" separators are converted to "\", and on a UNIX system, Windows "\" separators are converted to "/".

Note: The syntax of the file path does not depend on the file system of the platform where the file is actually stored; it depends only on the platform where your PeopleCode is executing.

Returns

None.

Example

CreateDirectory("D:\Resumes\New_Hires", %FilePath_Absolute);

Syntax

CreateDocument(DocumentKey | Package, DocumentName, Version)

Description

Use this method to instantiate a new Document object.

Important! When using this CreateDocument to instantiate a Document object, the object must stay in scope for as long as any child objects (Collection, Compound, or Primitive) generated from this Document object are referenced. Referencing a property on a child object of a Document object that has gone out of scope will result in the PeopleCode program failing to execute properly.

For example if you define a variable as a Document variable as local and instantiate it via CreateDocument within an application class method, any objects created off the Document object must be used within the method itself. If you need to pass references of any of the child objects, then the Document object should be a global variable or defined as part of the application class as a property.

Parameters

Field or Control

Definition

DocumentKey

Specifies a DocumentKey object that defines the document’s package, document name, and version.

Package

Specifies a document package as a string.

DocumentName

Specifies the name of the document as a string.

Note: The document name also becomes the root element name for the document.

Version

Specifies the document version as a string.

Returns

A Document object.

Example

The following provides two examples of instantiating a Document object. Both result in the same object.

Example 1:

Local Document &Doc;

/* Instatiate the Document object */
&Doc = CreateDocument("Purchasing", "PurchaseOrder", "v1");

Example 2:

Local Document &Doc;
Local DocumentKey &DocKey;

/* Instatiate the Document object */
&DocKey = CreateDocumentKey("Purchasing", "PurchaseOrder", "v1");
&Doc = CreateDocument(&DocKey);

Syntax

CreateDocumentKey(Package, DocumentName, Version)

Description

Use this method to instantiate a new DocumentKey object.

Parameters

Field or Control

Definition

Package

Specifies a document package as a string.

DocumentName

Specifies the name of the document as a string.

Note: The document name also becomes the root element name for the document.

Version

Specifies the document version as a string.

Returns

A DocumentKey object.

Example

The following provides an example of instantiating a Document object from a document key:

Local Document &Doc;
Local DocumentKey &DocKey;

/* Populating Document Object */
&DocKey = CreateDocumentKey("Purchasing", "PurchaseOrder", "v1");
&Doc = CreateDocument(&DocKey);

Syntax

CreateException(message_set, message_num, default_txt [, subslist])

where subslist is an arbitrary-length list of substitutions of undetermined (Any) data type to be substituted in the resulting text string, in the form:

substitution1 [, substitution2]. . .

Description

Use the CreateException function to create an exception object with the given properties. You can use this in your exception handling. Use this function either in conjunction with the throw statement, or on its own to get more information of a message.

Parameters

Field or Control

Definition

message_set

Specify the message set number of the message you want associated with this exception.

message_num

Specify the message number of the message you want associated with this exception.

default_txt

Specify the text you want associated with the exception if the message specified by message_set and message_num isn't found.

subslist

A comma-separated list of substitutions; the number of substitutions in the list is arbitrary. The substitutions are referenced in the message text using the % character followed by an integer corresponding to the position of the substitution in the subslist. The number of substitutions specified with this parameter are what get counted with the exception class SubsitutionCount property.

Returns

A reference to an exception object if successful, Null otherwise.

Example

Function t2 
   throw CreateException(2, 160, "'%1' doesn't support property or method '%2'", "SomeClass", "SomeMethod"); 
End-Function;

Syntax

CreateJavaArray(ElementClassName[], NumberOfElements)

Description

Use the CreateJavaArray function to create a Java array without knowing the number or value of the elements.

When you create an array in Java, you already know the number of elements in the array. If you do not know the number of elements in the array, but you want to use a Java array, use the CreateJavaArray function in PeopleCode. This creates a Java object that is a Java array, and you can pass in the number of elements that are to be in the array.

The first index in a Java array is 0. PeopleCode arrays start at 1.

Do the following to specify this type of array in Java:

new ElementClassName[NumberOfElements];

Parameters

Field or Control

Definition

ElementClassName[]

Specify the array class name. This parameter takes a string value.

NumberOfElements

Specify the number of elements in the array. This parameter takes a number value.

Returns

A Java object

Syntax

CreateJavaObject(ClassName [ConstructorParams])

Where ConstructorParams has the form

argument1 [, argument2] . . . 

Description

Use the CreateJavaObject function to create a Java object that can be manipulated in PeopleCode.

Note: If you create a class that you want to call using GetJavaClass, it can be located in a directory specified in the PS_CLASSPATH environment variable or in other specified locations. The PeopleCode API Reference provides details on where you can place custom and third-party Java classes.

See System Setup for Java Classes.

Use the CreateJavaObject function to create a Java array when you know how many values it should contain. If ClassName is the name of an array class (ending with [ ]), ConstructorParams are used to initialize the array.

In Java, do the following to initialize an array:

intArray = new int[]{1, 2, 3, 5, 8, 13};

Do the following to initialize such a Java array from PeopleCode:

&IntArray = CreateJavaObject("int[]", 1, 2, 3, 5, 8, 13);

To initialize a Java array without knowing the number of parameters until runtime, use the CreateJavaArray function.

Parameters

Field or Control

Definition

ClassName

Specify the name of an already existing class.

ConstructorParams

Specify any construction parameters required for the class. Constructors are matched by construction parameter type and placement.

Returns

A Java object.

Example

The following is an example of using dot notation and CreateJavaObject.

&CHARACTER.Value = CreateJavaObject(&java_path).GetField(&java_newchar).Value;
&NUMBER.Value = CreateJavaObject(&java_path).GetField(&java_newnum).Value;
&DATE.Value = CreateJavaObject(&java_path).GetField(&java_newdate).Value;      

Syntax

CreateJsonBuilder()

Description

Use the CreateJsonBuilder function to create a JsonBuilder object.

Parameters

None.

Returns

A reference to the newly created JsonBuilder object.

Example

Local JsonBuilder &jBldr = CreateJsonBuilder();

Syntax

CreateJsonParser()

Description

Use the CreateJsonParser function to create a JsonParser object.

Parameters

None.

Returns

A reference to the newly created JsonParser object.

Example

Local JsonParser &jParser = CreateJsonParser();

Syntax

CreateMCFIMInfo(UserID, Network)

Description

Use the CreateMCFIMInfo function to create an instance of the MCFIMInfo class. This is used to initiate the instant messaging session.

Parameters

Field or Control

Definition

UserID

Specify the PeopleSoft user as a string. This is the source user, or the user issuing the presence requests.

NetworkID

Specify which network to use for instant messaging. The values are:

  • AOL

  • Yahoo

Returns

An MCFIMInfo object if successful, a null value otherwise.

Syntax

CreateMessage(Operation.srvc_op_name [, message_type])

Description

Use the CreateMessage function to instantiate a Message object that refers to a message definition associated with a service operation. The CreateMessage function sets the following properties for the resulting Message object, based on the values set for the message definition:

  • Name

  • QueueName

  • Active

Other properties are set when the message is published or subscribed to (TransactionID and so on,) or are dynamically generated at other times (Size, EditError, and so on.)

For rowset-based messages, CreateMessage also sets the LANGUAGE_CD field in the level 0 PSCAMA record for a message based on the USERID default language group. If the message is being published from a component, the language code is set to the USERID language code for the component. If CreateMessage is called from a PeopleSoft Application Engine program, the language code of the user who started the batch process is used.

Parameters

Field or Control

Definition

Operation.srvc_op_name

Specify the name of the service operation you want to create a Message object for as a string value.

message_type

Specify the type of message that you want to create. Valid values are:

Value

Description

%IntBroker_Request

A request message. This is the default.

%IntBroker_Response

A response message.

%IntBroker_Fault

A fault message.

Returns

A Message object.

Example

The following example creates a request message &MSG associated with the DELETE_USER_PROFILE service operation.

Local Message &MSG;

&MSG = CreateMessage(Operation.DELETE_USER_PROFILE);

Syntax

CreateObject(str_class_name, create_par,  ...)

Where str_class_name either identifies:

  • A class by class name

  • A class of OLE Automation object in the form:

    app_name.object_name

Description

Use the CreateObject function to return an instance of a class. You can use this function to access an application class, a PeopleCode built-in object (like a chart), or an OLE Automation object.

If the class you are creating requires values to be passed, use the create_par parameters to supply them, or use the CreateObjectArray function.

Considerations for Instantiating Application Classes

You can use the CreateObject function to access an application class. You would want to do this when you were programming at a high-level, when you might not know the name of the class you wanted to access until runtime. You must specify a fully-qualified class name. In addition, the class name is case-sensitive.

The returned object has the type of class you specified.

Alternatively, when the application class name and path is known at design time, use the create function instead. See create for more information.

Considerations for Instantiating PeopleCode Built-in Objects

For example, to instantiate a Chart object without using a chart control (that is, without using the GetChart function) you could use:

&MyChart = CreateObject("Chart");

The returned object has the type of class you specified.

Note: The only way to instantiate a Crypt object is using the CreateObject function.

Considerations Using OLE Automation Objects

CreateObject returns an instance of an OLE Automation object as a variable of type Object.

The str_class_name argument uses the syntax app_name.object_type, which consists of: app_name (the name of the application providing the object) and object_type (the class or type of the object to create), separated by a period (dot).

Any application that supports OLE Automation exposes at least one type of object. For example, a spreadsheet application may provide an application object, a worksheet object, and a toolbar object.

To create an OLE Automation object, you assign the object returned by CreateObject to a variable of type Object:

local object &WORKSHEET;

&WORKSHEET = CreateObject("Excel.Sheet");

After an object is created, you can reference it using the object variable. In the previous example, you access properties and methods of the new object using the ObjectGetProperty, ObjectSetProperty, and ObjectDoMethod functions.

Note: If an object has registered itself as a single-instance object, only one instance of the object can be created, even if CreateObject is executed more than once. Note also that an object assigned to a global variable is not valid across processes: that is, the scope and lifetime of the global is the same as the scope and lifetime of the instance of PeopleTools in which the object was created.

Parameters

Field or Control

Definition

str_class_name

Specify the name of the class that you want to instantiate an object from.

create_par

Specify the parameters required by the class for instantiating the object.

Example

This example instantiates an Excel worksheet object, makes it visible, names it, saves it, and displays its name. Note the use of ObjectGetProperty in the example to return the Excel.Sheet.Application object.

&WORKAPP = CreateObject("COM", "Excel.Application"); 
&WORKBOOKS = ObjectGetProperty(&WORKAPP, "Workbooks"); 
/* This associates the INVOICE template w/the workbook */
ObjectDoMethod(&WORKBOOKS, "Add", "C:\TEMP\INVOICE.XLT"); 
ObjectDoMethod(&WORKAPP, "Save", "C:\TEMP\TEST1.XLS"); 
ObjectSetProperty(&WORKAPP, "Visible", True);

This following example illustrates the creation of an application class object. This code assumes that MyBaseClass is the superclass of both MySubclass1 and MySubclass2 classes.

local MyBaseClass &mbobj; 
local String &ClassName = "MySubclass1"; 
if &test then 
&ClassName = "MySubclass2"; 
end-if; 
&mbobj = CreateObject(&ClassName);

The following example creates a chart in an iScript, using the CreateObject function to generate a reference to a chart object.

Function IScript_GetChartURL() 
    
   Local Chart &oChart; 
   Local Rowset &oRowset; 
   Local string &sMap; 
   Local string &sURL; 
    
   &oChart = CreateObject("Chart"); 
    
   &oRowset = CreateRowset(Record.QE_CHART_RECORD); 
   &oRowset.Fill("where QE_CHART_REGION= :1", "MIDWEST"); 
   &oChart.SetData(&oRowset); 
    
   &oChart.Width = 400; 
   &oChart.Height = 300; 
    
   &oChart.SetDataYAxis(QE_CHART_RECORD.QE_CHART_SALES); 
   &oChart.SetDataXAxis(QE_CHART_RECORD.QE_CHART_PRODUCT); 
   &oChart.SetDataSeries(QE_CHART_RECORD.QE_CHART_REGION); 
    
   &oChart.HasLegend = True; 
   &oChart.LegendPosition = %ChartLegend_Right; 
    
   &sURL = %Response.GetChartURL(&oChart); 
   &sMap = &oChart.ImageMap; 
    
   %Response.Write("<HTML><IMG SRC="); 
   %Response.Write(&sURL); 
   %Response.Write("  USEMAP=#THEMAP></IMG><MAP NAME=THEMAP>"); 
   %Response.Write(&sMap); 
   %Response.Write("</MAP></HTML>"); 
    
End-Function;

Syntax

CreateObjectArray(Class_Name, Array_of_Args)

Description

Use the CreateObjectArray function to return an instance of a class.

Use this function when you must pass in parameters to create the object and you don’t know when you write the code how many parameters are required. If you can create the object without passing in additional values, or if you know how many parameters are required, use the CreateObject function instead.

The array of parameters is an array of Any. It must be a one-dimensional array, that is, you cannot pass in an array of array of Any. You cannot pass in field references, that is, you cannot pass in references of the form:

RECORD.FIELDNAME

If you do not want to supply any parameters, you can use an empty array, or a reference to a Null array.

Parameters

Field or Control

Definition

Class_Name

Specify the name of the class you want to create an instance of, as a string.

Array_Of_Args

Specify an Array of Any containing all parameters for creating an instance of the class.

Returns

A reference to newly created object.

Example

The following is an example of the creation of an Application Class object where the number of parameters used to create the object varies, depending on data in the database.

local String &ClassName, &RecName; 
local Record &Rec; 
 
/* Read class name and parameter record name from the database. */ 
SQLExec("SELECT CLASSNAME, RECNAME FROM %TABLE(RECORD.CLASSDATA)", &ClassName, &RecName); 
 
local Record &Rec = CreateRecord(@ ("RECORD." | &RecName)); 
 
/* Read the parameters from the database. */ 
local Array of Any &Params = CreateArrayAny(); 
 
SQLExec("%SelectAll(:1)", &Rec, &Params); 
 
/* Create the object. */ 
local MyPackage:BaseClass &Obj = CreateObjectArray(&ClassName, &Params);

Syntax

CreateProcessRequest([ProcessType, ProcessName])

Description

Use the CreateProcessRequest function to create a ProcessRequest object. After you’ve created this object, you can assign values to its properties then use the Schedule method to submit the process request for scheduling.

If you specify PSJob for the process type, the ProcessRequest object contains all the items of the job.

Parameters

Field or Control

Definition

ProcessType

Specify the process type as a string. Values depend on the process types defined for your system.

ProcessName

Specify the name of the process as a string.

Returns

A reference to a ProcessRequest object.

Example

Local ProcessRequest &MYRQST; 
 
&MYRQST = CreateProcessRequest("PSJOB", &MyJobName);

Syntax

CreateRecord(Record.recname)

Description

Use the CreateRecord function to create a standalone record definition and its component set of field objects. The specified record must have been defined previously, that is, it must have a record definition. However, if you are calling this function from PeopleCode associated with a page, the record does not have to be included on the current page.

The record and field objects created by this function are accessible only within PeopleCode. They can be used with any of the record and field object methods and properties. The record and field objects are automatically deleted when there are no remaining references to them stored in any variables.

The fields created by this function are initialized to null values. Default processing is not performed. No data associated with the record definition’s SQL table is brought in: only the record definition.

You can select into a record object created this way using the SelectByKey record class method. You can also select into it using the SQLExec function.

Parameters

Field or Control

Definition

Record. recname

Specify a record definition that already exists.

Returns

This function returns a record object that references a new record buffer and set of fields.

Example

Local Record &REC2; 
 
&REC2 = CreateRecord(RECORD.OPC_METH);

In the following example, a free-standing record is created (&PSBATREPREQRES). Values are assigned to the fields associated with the record. Then a second record is created (&PUBHDR), and the values from the first record are used to populate the second record.

&PSBATREPREQRES = CreateRecord(RECORD.PSBATREPREQRES); 
   &PSBATREPREQRES.BATREPID.Value = &BATREPID; 
   &PSBATREPREQRES.PUBID.Value = &MSG.Pubid; 
   &PSBATREPREQRES.CHNLNAME.Value = &MSG.ChannelName; 
   &PSBATREPREQRES.PUBNODE.Value = &MSG.PubNodeName; 
   &PSBATREPREQRES.MSGNAME.Value = &MSG.Name; 
 
   &PUBHDR = CreateRecord(RECORD.PSAPMSGPUBHDR); 
   &PSBATREPREQRES.CopyFieldsTo(&PUBHDR);

To create a PeopleCode record object for a record whose name is unknown when the PeopleCode is written, do the following.

Suppose a record name is in the PeopleCode variable &RECNAME. Use the @ operator to convert the string to a component name. The following code creates a corresponding record object:

&RECNAME = "RECORD." | Upper(&RECNAME); 
&REC = CreateRecord(@ &RECNAME);

The following example uses SQLExec to select into a record object, based on the effective date.

Local Record &DST; 
 
&DST = CreateRecord(RECORD.DST_CODE_TBL); 
&DST.SETID.Value = GetSetId(FIELD.BUSINESS_UNIT, DRAFT_BU, RECORD.DST_CODE_TYPE, ""); 
&DST.DST_ID.Value = DST_ID_AR; 
SQLExec("%SelectByKeyEffDt(:1,:2)", &DST, %Date, &DST); 
/* do further processing using record methods and properties */

Syntax

CreateRowset({RECORD.recname | &Rowset} [, {FIELD.fieldname, RECORD.recname | &Rowset}] .  .  .)

Description

Use the CreateRowset function to create an unpopulated, standalone rowset.

A standalone rowset is a rowset that has the specified structure, but is not tied to any data (that is, to the component buffer or to a message.) In addition, a standalone rowset isn’t tied to the Component Processor. When you fill it with data, no PeopleCode runs (like RowInsert, FieldDefault, and so on.)

The first parameter determines the structure of the rowset to be created.

If you specify a record as the first parameter, it’s used as the primary level 0 record. If you don’t specify any other parameters, you create a rowset containing one row, with one unpopulated record. To populate this type of rowset with data, you should only use:

  • the Fill or FillAppend rowset class methods

  • a record method (SelectByKey)

  • the SQLExec function

If you specify a rowset object, you are creating a new rowset based on the structure of the specified rowset object, including any child rowsets. It will not contain any data. If you want to populate this type of rowset with data, use the CopyTo method or a SQL statement.

Note: You should not use the rowset Select or SelectNew methods for populating rowsets created using CreateRowset. Use Fill or FillAppend instead.

Restrictions on Using CreateRowset

The following methods and properties don’t work with a rowset created using CreateRowset:

  • Select

  • SelectNew

  • Any GUI methods (like HideAllRows)

  • Any effective date methods or properties (like EffDt, EffSeq, or GetCurrEffRow)

In addition, rowsets created using CreateRowset are not automatically tied to the database. This means if you insert or delete rows, the rows will not be inserted or deleted in the database when you save the page.

Parameters

Field or Control

Definition

RECORD.recname | &Rowset

Specify either a record name or an existing rowset object.

FIELD.fieldname, RECORD.recname | &Rowset

Use FIELD.fieldname, RECORD.recname to specify a related display record. FIELD.fieldname refers to the controlling field, (not the related display field) while RECORD.recname refers to the related display record.

If you specify &rowset, you are adding a child rowset object to the newly created rowset. This must be an existing rowset object.

Returns

An unpopulated, standalone rowset object.

Example

The following creates a simple rowset of just a single record per row:

&RS = CreateRowset(RECORD.QA_MYRECORD);

The following creates a rowset with the same structure as the specified rowset:

&RS2 = CreateRowset(&RS);

The following code creates a rowset structure composed of four records in an hierarchical structure, that is,

QA_INVEST_HDR 
   QA_INVEST_LN 
      QA_INVEST_TRANS 
         QA_INVEST_DTL

Note that you have to start at the bottom of the hierarchy, and add the upper levels, not the other way around.

Local Rowset &RS, &RS2, &RS_FINAL; 
 
&RS2 = CreateRowset(RECORD.QA_INVEST_DTL); 
&RS = CreateRowset(RECORD.QA_INVEST_TRANS, &RS2); 
&RS2 = CreateRowset(RECORD.QA_INVEST_LN, &RS); 
&RS_FINAL = CreateRowset(RECORD.QA_INVEST_HDR, &RS2);

The following example reads all of the QA_MYRECORD records into a rowset, and returns the number of rows read:

&RS = CreateRowset(RECORD.QA_MYRECORD); 
&NUM_READ = &RS.Fill();

To make a clone of an existing rowset, that is, to make two distinct copies, you can do the following:

&RS2 = CreateRowset(&RS); 
&RS.CopyTo(&RS2);

The following code example is used for creating multiple children in a standalone rowset:

Local Rowset &rsBOCMRole, &rsBOCMRel, &rsBOCMUse;

   &rsBOCMRole = CreateRowset(Record.BO_CM_ROLE);
   &rsBOCMRel = CreateRowset(Record.BO_CM_REL);
   &rsBOCMUse = CreateRowset(Record.BO_CM_USE);
   &rsBOCM = CreateRowset(Record.BO_CM, &rsBOCMUse, &rsBOCMRole, &rsBOCMRel);

Syntax

CreateRowsetCache(&Rowset, [Rowset.]Name, Description)

Description

Use the CreateRowsetCache function to create a new RowsetCache object with the given name if it doesn't already exist.

Parameters

Field or Control

Definition

&Rowset

Specify an already instantiated and populated rowset that you want to use for creating a RowsetCache object. The RowsetCache object will have the same format and data as &Rowset.

Record. Name

Specify the name of the created RowsetCache object. If you just specify name, you must enclose the name in quotation marks.

Description

Specify a description of the RowsetCache as a string.

Returns

A reference to the new RowsetCache object if there is not already a RowsetCache object of the given name.

Example

Local RowsetCache &Cache;
Local Rowset &RS;

&RS = CreateRowset(Record.PSLANGUAGES);
&NUM_READ = &RS.Fill();

&Cache = CreateRowsetCache(&RS, "AAROWSET1", "ROWSET_AAROWSET1");

Syntax

CreateSearchRowset([counts])

Description

Use the CreateSearchRowset function to create the rowset based off of the search record and key list values.

Important! Use this function within fluid applications only.

Parameters

Field or Control

Definition

counts

The optional counts parameter is currently not supported.

Returns

A Rowset object.

Example

&RS_srch = CreateSearchRowset();

Syntax

CreateSOAPDoc()

Description

Use the CreateSOAPDoc function to create an empty SOAPDoc object. Then use the SOAPDoc class methods and properties, as well as the XmlDoc class methods and properties to populate the SOAPDoc object.

Parameters

None.

Returns

A reference to a SOAPDoc object.

Example

Local SOAPDoc &MyDoc;
&MyDoc = CreateSOAPDoc();

Syntax

CreateSQL([{sqlstring | SQL.SqlName}[, paramlist]])

Where paramlist is an arbitrary-length list of values in the form:

inval1 [, inval2] ...

Description

Use the CreateSQL function to instantiate a SQL object from the SQL class and opens it on the given sqlstring and input values. sqlstring is a PeopleCode string value giving the SQL statement.

Any errors in the SQL processing cause the PeopleCode program to be terminated with an error message.

You can use CreateSQL with no parameters to create an empty SQL object that can be used to assign properties before being populated and executed.

Opening and Processing sqlstring

If sqlstring is a SELECT statement, it is immediately bound with the inval input values and executed. The SQL object should subsequently be the subject of a series of Fetch method calls to retrieve the selected rows. If you want to fetch only a single row, use the SQLExec function instead. If you want to fetch a single row into a PeopleCode record object, use the record Select method.

If sqlstring is not a SELECT statement, and either there are some inval parameters, or there are no bind placeholders in the SQL statement, the statement is immediately bound and executed. This means that there is nothing further to be done with the SQL statement and the IsOpen property of the returned SQL object will be False. In this case, using the SQLExec function would generally be better. If you want to delete, insert or update a record object, use the record Delete, Insert, or Update methods.

If sqlstring is not a SELECT statement, there are no inval parameters, and there are bind placeholders in the SQL statement, the statement is neither bound nor executed. The resulting SQL object should subsequently be the subject of a series of Execute method calls to affect the desired rows.

Using Arrays with paramlist

You can use a parameter of type "Array of Any" in place of a list of bind values or in place of a list of fetch result variables. This is particularly useful when fetching an unknown number of results.

&SQL_1 = CreateSql("Select * from " | &TableName); 
&AAny = CreateArrayAny(); 
 
While &SQL_1.Fetch(&AAny) 
   /* Process the row in &AAny. */ 
   ... 
End-While;

Because the Array of Any promotes to absorb any remaining select columns, it must be the last parameter for the SQL object Fetch method or (for results) SQLExec. For binding, it must be the only bind parameter, as it is expected to supply all the bind values needed.

Parameters

Field or Control

Definition

sqlstring| SQL.SqlName

Specify either a SQL string containing the SQL command to be created or a reference to an existing SQL definition. This string can include bind variables, inline bind variables, and meta-SQL.

paramlist

Specify input values for the SQL string.

Returns

A SQL object.

Example

This SQL object should be used in a series of Fetch method calls:

Local SQL &SQL; 
 
&SQL = CreateSQL("%SelectAll(:1) where EMPLID = :2", RECORD.ABSENCE_HIST, &EMPLID);

This SQL object has been opened, bound, and is already closed again:

&SQL = CreateSQL("Delete from %Table(:1) where EMPLID = :2", RECORD.ABSENCE_HIST, &EMPLID);

This SQL object should be used in a series of Execute method calls:

&SQL = CreateSQL("Delete from %Table(:1) where EMPLID = :2"); 

This SQL object is created as an empty object in order to set properties before being executed:

&SQL = CreateSQL(); 
&SQL.Tracename = "SQL1"; 
&SQL.ReuseCursor = True; 
&SQL.Open(......); 

Syntax

CreateWSDLMessage(MessageName, ChannelName)

Description

Use the CreateWSDLMessage function to create an unstructured message. This function creates both the message as well as the channel.

This function has been deprecated. It is no longer supported.

Syntax

CreateXmlDoc(XmlString, DTDValidation)

Description

Use the CreateXmlDoc function to create an XmlDoc object. If you specify a Null string for XmlString (""), you create an empty XmlDoc object.

Considerations Using CreateXmlDoc

The following coding is either ignored or removed from the XmlDoc object that is created with this function:

  • encoding attributes

    PeopleSoft only supports UTF-8 encoding. Any specified encoding statement is removed, as all XmlDoc objects are considered UTF-8.

  • version attributes

    Regardless of what version is specified in XmlString, the version attribute in the generated XmlDoc object is 1.0.

Parameters

Field or Control

Definition

XmlString

Specify an XML string that you want to convert into an XmlDoc object that you can then manipulate using PeopleCode. You can also specify a Null string ("") to generate an empty XmlDoc object.

DTDValidation

Specify whether a DTD should be validated. This parameter takes a boolean value. If you specify true, the DTD validation occurs if a DTD is provided. If you specify false, and if a DTD is provided, it is ignored and the XML isn't validated against the DTD. False is the default value.

In the case of application messaging, if a DTD is provided, it's always ignored and the XML isn't validated against the DTD. If the XML cannot be validated against a DTD, an error is thrown saying that there was an XML parse error.

Returns

A reference to the newly created XmlDoc object.

Example

The following creates an empty XmlDoc object.

Local XmlDoc &MyDoc;
&MyDoc = CreateXmlDoc("");

Syntax

CreateXmlDocFactory()

Description

Use the CreateXmlFactory function to create an XmlDocFactory object.

Important! The XmlDocFactory object must be declared as a local variable only. Component and global scope are not supported.

Parameters

None.

Returns

A reference to an XmlDocFactory object.

Example

Local XmlDocFactory &theXmlDocFactory;

&theXmlDocFactory = CreateXmlDocFactory();

&returnbool = &theXmlDocFactory.SetStringToParse(&inputXmlString);

Syntax

CropImage(src_recfield, dst_recfield, [width, height])

Description

Use the CropImage function to crop a source image existing in a database record field and save it to a different destination record field in the database. The source and destination fields must be defined with the same image format: BMP, GIF, or, JPG only.

The image cropping can be constrained to a specific aspect ratio by specifying the optional [width and height parameters. These parameters define the aspect ratio only, and do not constrain the cropping to a specific size. If the aspect ratio is not specified, then the user will be unconstrained when cropping the image.

An error occurs and CropImage returns False when:

  • The source or destination field does not exist in the component buffer.

  • The source or destination field is not of type image

  • The image type of the destination field differs from that of the source field.

  • The destination image field is the same as the source image field.

Restrictions on Use in PeopleCode Events

CropImage is a “think-time” function, which means it shouldn’t be used in any of the following PeopleCode events:

  • SavePreChange

  • SavePostChange

  • Workflow

  • RowSelect

  • Any PeopleCode event that fires as a result of a ScrollSelect (or one of its relatives) function calls, or a Select (or one of its relatives) Rowset class method.

See Think-Time Functions.

Parameters

Field or Control

Definition

src_recfield

Specifies the record field location of the source image file.

dst_recfield

Specifies the record field location of the destination image file.

width

Specifies an aspect ratio width as a numeric value.

height

Specifies an aspect ratio height as a numeric value.

Important! If the width is specified, but the height is omitted, the PeopleCode program will pass syntax checking. However, at run time, the user will encounter an error and will not be able to crop the image.

Returns

A Boolean value: True when successful, False otherwise.

Example

&bRet = CropImage(QE_IMAGE.QE_IMAGE, QE_IMAGE_CROP.QE_CROP_IMAGE, 60, 90);

Syntax

CubicSpline(DataPoints, Control_Option, Left_Constraint, Right_Constraint)

Description

Use the CubicSpline function to compute a cubic spline interpolation through a set of at least four datapoints.

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.

Control_Option

Specifies the control option. This parameter takes either a number or constant value. The values are:

Numeric Value

Constant Value

Description

0

%SplineOpt_SlEstEst

Generate an internal estimate of the beginning and ending slope of the cubic piecewise equations

1

%SplineOpt_SlSetEst

Use the user-specified value for the slope of the leftmost point, and generate an estimate for the rightmost point

2

%SplineOpt_SlEstSet

Use the user-specified value for the slope of the rightmost point, and generate an estimate for the leftmost point

3

%SplineOpt_SlSetSet

Use the user-specified values for the slopes of the leftmost and rightmost points

4

%SplineOpt_CvEstEst

Generate an internal estimate of the beginning and ending curvature of the cubic piecewise equations

5

%SplineOpt_CvSetEst

Use the user-specified value for the curvature of the leftmost point, and generate an estimate for the rightmost point

6

%SplineOpt_CvEstSet

Use the user-specified value for the curvature of the rightmost point, and generate an estimate for the leftmost point

7

%SplineOpt_CvSetSet

Use the user-specified values for the curvatures of the leftmost and rightmost points

8

%SplineOpt_ClEstEst

Generate an internal estimate of the beginning and ending curl of the cubic piecewise equations

9

%SplineOpt_ClSetEst

Use the user-specified value for the curl of the leftmost point, and generate an estimate for the rightmost point

10

%SplineOpt_ClEstSet

Use the user-specified value for the curl of the rightmost point, and generate an estimate for the leftmost point

11

%SplineOpt_ClSetSet

Use the user-specified values for the curls of the leftmost and rightmost points

12

%SplineOpt_Natural

Generate a “natural” spline

13

%SplineOpt_ContCurl

Generate a spline wherein the equation for the first segment is the exact same equation for the second segment, and where the equation for the penultimate segment is the same as the equation for the last segment.

Field or Control

Definition

Left_Constraint

A single number for the constraint for the left point. Specify a zero if this parameter isn’t needed.

Right_Constraint

A single number for the constraint for the right point. Specify a zero if this parameter isn’t needed.

Returns

A modified array of array of numbers. The elements in the array correspond to the elements in the array used for DataPoints.

Syntax

CurrEffDt([level_num])

Description

Use the CurrEffDt function to return the effective date of the specified scroll level as a Date value.

Note: This function remains for backward compatibility only. Use the EffDt rowset class property instead.

If no level is specified, CurrEffDt returns the effective date of the current scroll level.

Returns

Returns a Date value equal to the current effective date of the specified scroll level.

Example

If INSTALLATION.POSITION_MGMT = "P" Then
   If All(POSITION_NBR) Then
      If (EFFDT = CurrEffDt(1) and
            EFFSEQ >= CurrEffSeq(1)) or
            (EFFDT > CurrEffDt(1) and
               EFFDT = %Date) Then
         Gray_employment( );
       End-if;
   End-if;
End-if;

Syntax

CurrEffRowNum([level_num])

Description

Use the CurrEffRowNum function to return the effective row number of the selected scroll level.

Note: This function remains for backward compatibility only. Use the RowNumber row class property, in combination with the GetCurrEffRow rowset method, instead.

If no level is specified, it returns the effective row number of the current level.

Example

&ROW = CurrEffRowNum(1);

Syntax

CurrEffSeq([level_num])

Description

Use the CurrEffSeq function to determine the effective sequence of a specific scroll area.

Note: This function remains for backward compatibility only. Use the EffSeq rowset class property instead.

If no level is specified, CurrEffSeq returns the effective sequence of the current scroll level.

Returns

Returns a Number representing the effective sequence of the specified scroll level.

Example

If INSTALLATION.POSITION_MGMT = "P" Then
   If All(POSITION_NBR) Then
      If (EFFDT = CurrEffDt(1) and
            EFFSEQ >= CurrEffSeq(1)) or
            (EFFDT > CurrEffDt(1) and
               EFFDT = %Date) Then
         Gray_employment( );
       End-if;
   End-if;
End-if;

Syntax

CurrentLevelNumber()

Description

Use the CurrentLevelNumber function to return the scroll level where the function call is located.

Returns

Returns a Number value equal to the scroll level where the function is being called. The function returns 0 if the field where the function is called is not in a scroll area.

Example

&LEVEL = CurrentLevelNumber();

Syntax

CurrentRowNumber([level])

Description

Use the CurrentRowNumber function to determine the row number of the row currently displayed in a specific scroll area.

Note: This function remains for backward compatibility only. Use the RowNumber row class property instead.

This function can determine the current row number on the level where the function call resides, or on a higher scroll level. It won’t work on a scroll level below the one where the PeopleCode program resides.

Parameters

Field or Control

Definition

level

A Number specifying the scroll level from which the function returns the current row number. If the level parameter is omitted, it defaults to the scroll level where the function call resides.

Returns

Returns a Number value equal to the current row number on the specified scroll level. The current number is the row where the PeopleCode program is being processed, or, if level specifies a higher level scroll, CurrentRowNumber returns the row number of the parent or grandparent row.

Example

CurrentRowNumber is typically used in component buffer functions to return the current row of the parent scroll of the target:

&VAL = FetchValue(RECORD.BUS_EXPENSE_PER, CurrentRowNumber(), BUS_EXPENSE_DTL.CHARGE_DT, &COUNT);

The following example checks if the current row number is equal to the active row count (that is, whether the active row is the last record on the scroll):

If CurrentRowNumber() = ActiveRowCount(EMPLID) Then
   det_employment_dt();
End-if;