PeopleCode Built-in Functions

This chapter provides a reference to PeopleCode built-in functions and language constructs and discusses:

Click to jump to parent topicPeopleCode Typographical Conventions

Throughout this book, we use typographical conventions to distinguish between different elements of the PeopleCode language, such as bold to indicate function names, italics for arguments, and so on.

Please take a moment to review the following typographical cues:

Font Type

Description

monospace font

Indicates a PeopleCode program or other example

Keyword

In PeopleCode syntax, items in keyword font indicate function names, method names, language constructs, and PeopleCode reserved words that must be included literally in the function call.

Variable

In PeopleCode syntax, items in variable font are placeholders for arguments that your program must supply.

...

In PeopleCode syntax, ellipses indicate that the preceding item or series can be repeated any number of times.

{Option1|Option2}

In PeopleCode syntax, when there is a choice between two options, the options are enclosed in curly braces and separated by a pipe.

[ ]

In PeopleCode syntax optional items are enclosed in square brackets.

&Parameter

In PeopleCode syntax an ampersand before a parameter indicates that the parameter is an already instantiated object, or is a parameter variable that will receive a value during the execution of the function.

Click to jump to parent topicFunctions by Category

The following topics subdivide the PeopleCode built-in functions by functional category and provide links from within each category to the reference entries.

Click to jump to top of pageClick to jump to parent topicAnalytic Calculation Engine

CreateAnalyticInstance

GetAnalyticInstance

GetAnalyticGrid

Click to jump to top of pageClick to jump to parent topicAPIs

CreateObject

GetSession

%Session

Click to jump to top of pageClick to jump to parent topicApplication Classes

CollectGarbage

Click to jump to top of pageClick to jump to parent topicApplication Engine

CallAppEngine

CommitWork

GetAESection

Click to jump to top of pageClick to jump to parent topicApplication Logging

WriteToLog

%ApplicationLogFence

Click to jump to top of pageClick to jump to parent topicArrays

CopyFromJavaArray

CopyToJavaArray

CreateArray

CreateArrayAny

CreateArrayRept

Split

Click to jump to top of pageClick to jump to parent topicAttachment

AddAttachment

CopyAttachments

DeleteAttachment

DetachAttachment

GetAttachment

PutAttachment

ViewAttachment

See Also

Files, Images.

Click to jump to top of pageClick to jump to parent topicBulk

BulkDeleteField

BulkInsertField

BulkModifyPageFieldOrder

BulkUpdateIndexes

Click to jump to top of pageClick to jump to parent topicBusiness Interlink

GetBiDoc

GetInterlink

%MaxInterlinkSize

Click to jump to top of pageClick to jump to parent topicCharacter Processing

CharType

ContainsCharType

ContainsOnlyCharType

ConvertChar

DBCSTrim

Click to jump to top of pageClick to jump to parent topicChart

CreateObject

GetChart

GetChartURL

Click to jump to top of pageClick to jump to parent topicChartField

RenameDBField

RenamePage

RenameRecord

SetDBFieldAuxFlag

SetDBFieldCharDefn

SetDBFieldFormat

SetDBFieldFormatLength

SetDBFieldLabel

SetDBFieldLength

SetDBFieldNotUsed

SetPageFieldPageFieldName

SetRecFieldEditTable

SetRecFieldKey

Click to jump to top of pageClick to jump to parent topicComponent Buffer

ActiveRowCount

AddKeyListItem

ClearKeyList

CompareLikeFields

ComponentChanged

CopyFields

CopyRow

CurrentLevelNumber

CurrentRowNumber

DeleteRecord

DeleteRow

DiscardRow

ExpandBindVar

ExpandEnvVar

ExpandSqlBinds

FetchValue

FieldChanged

GetNextNumber

GetNextNumberWithGaps

GetNextNumberWithGapsCommit

GetRelField

GetSetId

InsertRow

IsDate

PriorValue

RecordChanged

RecordDeleted

RecordNew

RowFlush

SetComponentChanged

SetDefault

SetDefaultAll

SetTempTableInstance

StopFetching

TotalRowCount

TreeDetailInNode

UpdateSysVersion

UpdateValue

ViewContentURL

%BINARYSORT

%Component

%Menu

%Mode

%OperatorClass

%Table

%TruncateTable

See Also

Data Buffer Access.

Click to jump to top of pageClick to jump to parent topicComponent Interface

GetMethodNames

GetProgramFunctionInfo

GetSession

StartWork

%CompIntfcName

Click to jump to top of pageClick to jump to parent topicConversion

Char

Code

ConvertChar

NumberToString

String

Value

Click to jump to top of pageClick to jump to parent topicCurrency and Financial

Amortize

BlackScholesPut

ConvertCurrency

RoundCurrency

SinglePaymentPV

UniformSeriesPV

%Currency

Click to jump to top of pageClick to jump to parent topicCurrent Date and Time

%CurrentDateIn

%CurrentDateOut

%CurrentDateTimeIn

%CurrentDateTimeOut

%CurrentTimeIn

%CurrentTimeOut

See Also

Date and Time, SQL Date and Time.

Click to jump to top of pageClick to jump to parent topicCustom Display Formats

GetStoredFormat

SetDisplayFormat

Click to jump to top of pageClick to jump to parent topicDatabase and Platform

%DbName

%DbServerName

%DbType

Click to jump to top of pageClick to jump to parent topicData Buffer Access

CreateRecord

CreateRowset

FlushBulkInserts

GetField

GetLevel0

GetRecord

GetRow

GetRowset

See Also

Component Buffer.

Click to jump to top of pageClick to jump to parent topicDate and Time

AddToDate

AddToDateTime

AddToTime

ConvertDatetimeToBase

Date

Date3

DatePart

DateTime6

DateTimeToHTTP

DateTimeToLocalizedString

DateTimeToTimeZone

DateTimeValue

DateValue

Day

Days

Days360

Days365

FormatDateTime

GetCalendarDate

Hour

IsDaylightSavings

Minute

Month

Second

Time

Time3

TimePart

TimeToTimeZone

TimeValue

TimeZoneOffset

Weekday

IsDate

Year

%AsOfDate

%ClientDate

%ClientTimeZone

%Date

%DateAdd

%DateDiff

%DateTime

%DateTimeDiff

%DateTimeIn

%DateTimeOut

%DTTM

%PerfTime

%PermissionLists

%ServerTimeZone

%Time

%TextIn

See Also

Current Date and Time, SQL Date and Time.

Click to jump to top of pageClick to jump to parent topicDebugging

CreateException

SetTracePC

SetTraceSQL

Throw

%Test

Try

WinMessage

WriteToLog

%ApplicationLogFence

Click to jump to top of pageClick to jump to parent topicDefaults, Setting

SetDefault

SetDefaultAll

SetDefaultNext

SetDefaultNextRel

SetDefaultPrior

SetDefaultPriorRel

Click to jump to top of pageClick to jump to parent topicEffective Date and Effective Sequence

CurrEffDt

CurrEffRowNum

CurrEffSeq

NextEffDt

NextRelEffDt

PriorEffDt

PriorRelEffDt

SetDefaultNext

SetDefaultNextRel

SetDefaultPrior

SetDefaultPriorRel

%EffDtCheck

Click to jump to top of pageClick to jump to parent topicEmail

AddEmailAddress

ChangeEmailAddress

DeleteEmailAddress

MarkPrimaryEmailAddress

Click to jump to top of pageClick to jump to parent topicEnvironment

ExpandEnvVar

GetCwd

GetEnv

%PID

Click to jump to top of pageClick to jump to parent topicExceptions

CreateException

Throw

Try

Click to jump to top of pageClick to jump to parent topicExecutable Files, Running

Exec

WinExec

See Also

Object.

Click to jump to top of pageClick to jump to parent topicFiles

CreateDirectory

FileExists

FindFiles

GetFile

RemoveDirectory

%FilePath

See Also

Attachment, Images.

Click to jump to top of pageClick to jump to parent topicFinancial

AccruableDays

AccrualFactor

BlackScholesCall

BlackScholesPut

BootstrapYTMs

ConvertRate

CubicSpline

HermiteCubic

HistVolatility

LinearInterp

Click to jump to top of pageClick to jump to parent topicGrids

GetGrid

Click to jump to top of pageClick to jump to parent topicImages

DeleteImage

GetImageExtents

InsertImage

See Also

Attachment, Files.

Click to jump to top of pageClick to jump to parent topicIntegration Broker

IBPurgeDomainStatus

IBPurgeNodesDown

ConnectorRequest

ConnectorRequestURL

CreateWSDLMessage

EncryptNodePswd

FindCodeSetValues

NodeDelete

NodeRename

NodeSaveAs

NodeTranDelete

PingNode

RelNodeTranDelete

SetChannelStatus

SetMessageStatus

Transform

TransformEx

TransformExCache

%IntBroker

%TransformData

Click to jump to top of pageClick to jump to parent topicInternet

CreateSOAPDoc

EncodeURL

EncodeURLForQueryString

EscapeHTML

EscapeJavascriptString

EscapeWML

GenerateActGuideContentUrl

GenerateActGuidePortalUrl

GenerateActGuideRelativeUrl

GenerateComponentContentRelURL

GenerateComponentContentURL

GenerateComponentPortalRelURL

GenerateComponentPortalURL

GenerateComponentRelativeURL

GenerateExternalPortalURL

GenerateExternalRelativeURL

GenerateHomepagePortalURL

GenerateHomepageRelativeURL

GenerateQueryContentURL

GenerateQueryPortalURL

GenerateQueryRelativeURL

GenerateScriptContentRelURL

GenerateScriptContentURL

GenerateScriptPortalRelURL

GenerateScriptPortalURL

GenerateScriptRelativeURL

GenerateTree

GenerateWorklistPortalURL

GenerateWorklistRelativeURL

GetChartURL

GetHTMLText

GetMethodNames

GetURL

Unencode

ViewContentURL

ViewURL

%ContentID

%ContentType

%EmailAddress

%HPTabName

%LocalNode

%Node

%Portal

%Request

%Response

%RunningInPortal

Click to jump to top of pageClick to jump to parent topicJava

CopyFromJavaArray

CopyToJavaArray

CreateJavaArray

CreateJavaObject

GetJavaClass

Click to jump to top of pageClick to jump to parent topicLanguage Constructs

Break

Component

Continue

Declare Function

Evaluate

Exit

For

Function

Global

If

Local

Repeat

Return

Throw

Try

While

Click to jump to top of pageClick to jump to parent topicLanguage Preference and Locale

SetLanguage

%IsMultiLanguageEnabled

%Language

%Language_Base

%Language_Data

%Language_User

%Market

Click to jump to top of pageClick to jump to parent topicLogical (Tests for Blank Values)

All

AllOrNone

None

OnlyOne

OnlyOneOrNone

Click to jump to top of pageClick to jump to parent topicMail

SendMail

%EmailAddress

Click to jump to top of pageClick to jump to parent topicMath

Abs

Acos

Asin

Atan

Cos

Cot

Degrees

Exp

Fact

Idiv

Int

Integer

Ln

Log10

Max

Min

Mod

Product

Radians

Rand

Round

Sign

Sin

Sqrt

Tan

Truncate

%Abs

%DecDiv

%DecMult

%Round

%Truncate

Click to jump to top of pageClick to jump to parent topicMenu Appearance

CheckMenuItem

DisableMenuItem

EnableMenuItem

HideMenuItem

UnCheckMenuItem

Click to jump to top of pageClick to jump to parent topicMessage Catalog and Message Display

EndMessage

Error

MessageBox

MsgGet

MsgGetExplainText

MsgGetText

Quote

Warning

WinMessage

Click to jump to top of pageClick to jump to parent topicMessages

AddSystemPauseTimes

CreateMessage

CreateWSDLMessage

DeleteSystemPauseTimes

GetMessage

GetSyncLogData

IsMessageActive

PingNode

ReturnToServer

SetChannelStatus

SetMessageStatus

%MaxMessageSize

See Also

XML.

Click to jump to top of pageClick to jump to parent topicMobile

IsDisconnectedClient

GenerateMobileTree

MSFGetNextNumber

TransferMobilePage

%CompIntfcName

%DeviceType

%MobilePage

%Session

%SyncServer

%ThisMobileObject

Click to jump to top of pageClick to jump to parent topicModal Transfers

DoModalComponent

EndModalComponent

IsModalComponent

See Also

Secondary Pages, Transfers.

Click to jump to top of pageClick to jump to parent topicMultiChannel Framework

CreateMCFIMInfo

DeQueue

EnQueue

Forward

InitChat

MCFBroadcast

NotifyQ

Click to jump to top of pageClick to jump to parent topicObject

CreateObject

CreateObjectArray

ObjectDoMethod

ObjectDoMethodArray

ObjectGetProperty

ObjectSetProperty

Click to jump to top of pageClick to jump to parent topicObject-Based

CreateArray

CreateArrayRept

CreateException

CreateJavaArray

CreateJavaObject

CreateMessage

CreateObject

CreateObjectArray

CreateProcessRequest

CreateRecord

CreateRowset

CreateSOAPDoc

CreateSQL

CreateXmlDoc

DeleteSQL

FetchSQL

GetAESection

GetChart

GetChartURL

GetCwd

GetField

GetFile

GetGrid

GetHTMLText

GetInterlink

GetLevel0

GetJavaClass

GetMessage

GetMessageXmlDoc

GetMessageInstance

GetPubContractInstance

GetRecord

GetRow

GetRowset

GetSession

GetSQL

GetSubContractInstance

LogObjectUse

ObjectDoMethod

ObjectDoMethodArray

ObjectGetProperty

ObjectSetProperty

ReturnToServer

Split

StoreSQL

Click to jump to top of pageClick to jump to parent topicPage

GetPage

Click to jump to top of pageClick to jump to parent topicPage Control Appearance

GetImageExtents

Gray

Hide

HideRow

HideScroll

IsHidden

SetCursorPos

SetLabel

Ungray

Unhide

UnhideRow

UnhideScroll

Click to jump to top of pageClick to jump to parent topicPersonalizations

GetUserOption

SetUserOption

Click to jump to top of pageClick to jump to parent topicProcess Scheduler

CreateProcessRequest

GetNextProcessInstance

SetPostReport

SetupScheduleDefnItem

%OutDestFormat

%OutDestType

Click to jump to top of pageClick to jump to parent topicRemote Call

DoSaveNow

RemoteCall

Click to jump to top of pageClick to jump to parent topicRowsetCache

CreateRowsetCache

GetRowsetCache

Click to jump to top of pageClick to jump to parent topicSaving and Canceling

DoCancel

DoSave

DoSaveNow

WinEscape

Click to jump to top of pageClick to jump to parent topicScroll Select

RowFlush

RowScrollSelect

RowScrollSelectNew

ScrollFlush

ScrollSelect

ScrollSelectNew

SortScroll

Click to jump to top of pageClick to jump to parent topicSearch Dialog

ClearSearchDefault

ClearSearchEdit

IsSearchDialog

SetSearchDefault

SetSearchDialogBehavior

SetSearchEdit

%Mode

Click to jump to top of pageClick to jump to parent topicSecondary Pages

DoModal

EndModal

IsModal

See Also

Modal Transfers, Transfers.

Click to jump to top of pageClick to jump to parent topicSQL

CreateSQL

DeleteSQL

ExpandBindVar

ExpandSqlBinds

FetchSQL

FlushBulkInserts

GetSQL

SQLExec

StoreSQL

%FirstRows

%InsertSelect

%InsertValues

%Join

%KeyEqual

%KeyEqualNoEffDt

%Like

%LikeExact

%NoUppercase

%OldKeyEqual

%SQL

%SignonUserId

%SQL

%SQLRows

%Table

%UpdatePairs

See Also

Data Buffer Access, Scroll Select.

Click to jump to top of pageClick to jump to parent topicSQL Date and Time

%DateAdd

%DateDiff

%DatePart

%DateNull

%DateIn

%DateTimeNull

%DateOut

%DateTimeDiff

%DateTimeIn

%DateTimeOut

%DTTM

%TimeAdd

%TextIn

%TimeIn

%TimeNull

%TimePart

%TimeOut

See Also

Current Date and Time, Date and Time.

Click to jump to top of pageClick to jump to parent topicSQL Shortcuts

%Delete

%Insert

%SelectAll

%SelectDistinct

%SelectByKey

%SelectByKeyEffDt

%Update

Click to jump to top of pageClick to jump to parent topicString

Clean

Code

%COALESCE

%Concat

DBPatternMatch

Exact

ExpandBindVar

ExpandEnvVar

Find

GetHTMLText

IsAlpha

IsAlphaNumeric

IsDigits

Left

Len

Lower

LTrim

NumberToDisplayString

NumberToString

Proper

Quote

Replace

Rept

Right

RTrim

String

Substitute

Substring

Upper

%Abs

%NumToChar

%Substring

%TrimSubstr

%Upper

Click to jump to top of pageClick to jump to parent topicSubrecords

%SUBREC

Click to jump to top of pageClick to jump to parent topicTimeZone

ConvertDatetimeToBase

ConvertTimeToBase

DateTimeToTimeZone

FormatDateTime

IsDaylightSavings

TimeToTimeZone

TimeZoneOffset

%ClientTimeZone

%ServerTimeZone

Click to jump to top of pageClick to jump to parent topicTrace Control

SetTracePC

SetTraceSQL

Click to jump to top of pageClick to jump to parent topicTransfers

AddKeyListItem

ClearKeyList

SetNextPage

Transfer

TransferExact

TransferNode

TransferPage

TransferPortal

See Also

Modal Transfers, Secondary Pages.

Click to jump to top of pageClick to jump to parent topicType Checking

IsUserNumber

ValueUser

IsAlpha

IsAlphaNumeric

IsDate

IsDateTime

IsDigits

IsNumber

IsTime

Max

Min

NumberToString

Click to jump to top of pageClick to jump to parent topicUser Information

%EmailAddress

%EmployeeId

%UserDescription

%UserId

Click to jump to top of pageClick to jump to parent topicUser Security

AllowEmplIdChg

Decrypt

Encrypt

ExecuteRolePeopleCode

ExecuteRoleQuery

ExecuteRoleWorkflowQuery

Hash

IsMenuItemAuthorized

IsUserInPermissionList

IsUserInRole

RevalidatePassword

SetAuthenticationResult

SetPasswordExpired

SwitchUser

%AuthenticationToken

%EmployeeId

%ExternalAuthInfo

%NavigatorHomePermissionList

%PasswordExpired

%PermissionLists

%PrimaryPermissionList

%ProcessProfilePermissionList

%PSAuthResult

%ResultDocument

%Roles

%RowSecurityPermissionList

%SignonUserId

%SignOnUserPswd

%UserId

Click to jump to top of pageClick to jump to parent topicValidation

Error

IsMenuItemAuthorized

RevalidatePassword

SetCursorPos

SetReEdit

Warning

Click to jump to top of pageClick to jump to parent topicWorkflow

GenerateActGuideContentUrl

GenerateActGuidePortalUrl

GenerateActGuideRelativeUrl

GetWLFieldValue

MarkWLItemWorked

TriggerBusinessEvent

%AllowNotification

%AllowRecipientLookup

%BPName

%SMTPBlackberryReplyTo

%SMTPGuaranteed

%SMTPSender

%WLInstanceID

%WLName

Click to jump to top of pageClick to jump to parent topicXML

CancelPubHeaderXmlDoc

CancelPubXmlDoc

CancelSubXmlDoc

CreateSOAPDoc

CreateXmlDoc

GetArchPubHeaderXmlDoc

GetArchPubXmlDoc

GetArchSubXmlDoc

GetMessageXmlDoc

GetNRXmlDoc

GetPubHeaderXmlDoc

GetPubXmlDoc

GetSubXmlDoc

GetSyncLogData

InboundPublishXmlDoc

PublishXmlDoc

ReSubmitPubHeaderXmlDoc

ReSubmitPubXmlDoc

ReSubmitSubXmlDoc

ReValidateNRXmlDoc

SyncRequestXmlDoc

Transform

UpdateXmlDoc

Click to jump to parent topicPeopleCode Built-in Functions and Language Constructs

The following are the PeopleCode Built-In functions.

Click to jump to top of pageClick to jump to parent topicAbs

Syntax

Abs(x)

Description

Use the Abs function to return a decimal value equal to the absolute value of a number x.

Parameters

x

Specify the number you want the decimal value for.

Example

The example returns the absolute value of the difference between &NUM_1 and &NUM_2:

&RESULT = Abs(&NUM_1 - &NUM_2);

See Also

Sign, %Abs.

Click to jump to top of pageClick to jump to parent topicAccruableDays

Syntax

AccruableDays(StartDate, EndDate, Accrual_Conv)

Description

Use the AccruableDays function to return the number of days during which interest can accrue in a given range of time according to the Accrual_Conv parameter.

Parameters

StartDate

The beginning of the time period for determining the accrual. This parameter takes a date value.

EndDate

The end of the time period for determining the accrual. This parameter takes a date value.

Accrual_Conv

The accrual convention. This parameter takes either a number or a constant value. Values for this parameter are:

 

Numeric Value

Constant Value

Description

0

%Accrual_30DPM

30/360: all months 30 days long according to NASD rules for date truncation

1

%Accrual_30DPME

30E/360: all months 30 days long according to European rules for date truncation

2

N/A 

30N/360: all months but February are 30 days long according to SIA rules

3

%Accrual_Fixed360

Act/360: months have variable number of days, but years have fixed 360 days

4

%Accrual_Fixed365

Act/365: months have variable number of days, buy years have fixed 365 days

5

%Accrual_ActualDPY

Act/Act: months and years have a variable number of days

Returns

An integer representing a number of days.

See Also

AccrualFactor.

Click to jump to top of pageClick to jump to parent topicAccrualFactor

Syntax

AccrualFactor(StartDate, EndDate, Accrual_Conv)

Description

Use the AccrualFactor function to compute a factor that's equal to the number of years of interest accrued during a date range, according to Accrual_Conv parameter.

Parameters

StartDate

The beginning of the time period for determining the accrual. This parameter takes a date value.

EndDate

The end of the time period for determining the accrual. This parameter takes a date value.

Accrual_Conv

The accrual convention. This parameter takes either a number or constant value. Values for this parameter are:

 

Numeric Value

Constant Value

Description

0

%Accrual_30DPM

30/360: all months 30 days long according to NASD rules for date truncation

1

%Accrual_30DPME

30E/360: all months 30 days long according to European rules for date truncation

2

N/A 

30N/360: all months but February are 30 days long according to SIA rules

3

%Accrual_Fixed360

Act/360: months have variable number of days, but years have fixed 360 days

4

%Accrual_Fixed365

Act/365: months have variable number of days, buy years have fixed 365 days

5

%Accrual_ActualDPY

Act/Act: months and years have a variable number of days

Returns

A floating point number representing a number of years.

See Also

AccruableDays.

Click to jump to top of pageClick to jump to parent topicAcos

Syntax

Acos(value)

Description

Use the Acos function to calculate the arccosine of the given value, that is, the size of the angle whose cosine is that value.

Parameters

value

Any real number between -1.00 and 1.00 inclusive, the range of valid cosine values. If the input value is outside this range, an error message appears at runtime ("Decimal arithmetic error occurred. (2,110)"). Adjust your code to provide a valid input value.

Returns

A value in radians between 0 and pi.

Example

The following example returns the size in radians of the angle whose cosine is 0.5:

&MY_ANGLE = Acos(0.5);

See Also

Asin, Atan, Cos, Cot, Degrees, Radians, Sin, Tan.

Click to jump to top of pageClick to jump to parent topicActiveRowCount

Syntax

ActiveRowCount(Scrollpath)

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 ActiveRowCount function to return the number of active (non-deleted) rows for a specified scroll area in the active page.

Note. This function remains for backward compatibility only. Use the ActiveRowCount Rowset class property instead.

ActiveRowCount is often used to get a limiting value for a For statement. This enables you to loop through the active rows of a scroll area, performing an operation on each active row. Rows that have been marked as deleted are not affected in a For loop delimited by ActiveRowCount. If you want to loop through all the rows of a scroll area, including deleted rows, use TotalRowCount.

Use ActiveRowCount with CurrentRowNumber to determine whether the user is on the last row of a record.

See Also

ActiveRowCount.

Accessing the Data Buffer

Specifying Data with References Using Scroll Path Syntax and Dot Notation

Parameters

scrollpath

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

Returns

Returns a Number value equal to the total active (non-deleted) rows in the specified scroll area in the active page.

Example

In this example ActiveRowCount is used to delimit a For loop through a level-one scroll:

&CURRENT_L1 = CurrentRowNumber(1); &ACTIVE_L2 = ActiveRowCount(RECORD.ASSIGNMENT, &CURRENT_L1, RECORD.ASGN_HOME_HOST); &HOME_HOST = FetchValue(RECORD.ASSIGNMENT, &CURRENT_L1, ASGN_HOME_HOST.HOME_HOST, 1); If All(&HOME_HOST) Then For &I = 1 To &ACTIVE_L2 DeleteRow(RECORD.ASSIGNMENT, &CURRENT_L1, RECORD.ASGN_HOME_HOST, 1); End-For; End-If;

See Also

CurrentRowNumber, TotalRowCount, For.

Click to jump to top of pageClick to jump to parent topicAddAttachment

Syntax

AddAttachment(URLDestination, DirAndFilename, FileType, UserFile[, MaxSize] [, PreserveCase, UploadPageTitle]

where URLDestination can have one of the following forms:

URL.URLname

Or a string URL, such as

ftp://user:password@ftp.ps.com/

Note. You cannot specify a different port for an attachment when using an FTP server. You can only use the default port of 21.

Note. If you're copying from a database table, you can either create an entry for this record (URL) in the URL Maintenance page, or specify it in your PeopleCode, as follows:

record://RESUMES_DB

Note. The file attachment functionality does not support SFTP or FTPS.

Description

Use the AddAttachment function to transfer a file from one server to another. You could use this to associate a file with a row in a record, or with a page of data.

Note. If the specified subdirectories don't exist this function tries to create them.

File Name Considerations

When the file is transferred, the following characters are replaced with an underscore:

Note. The AddAttachment function does not guarantee the uniqueness of the file names that get uploaded. If your application requires unique file name, you must write code to test the file names before they are uploaded.

Restrictions on Use in PeopleCode Events

AddAttachment is a “think-time” function, which means that it should not be used in any of the following PeopleCode events:

If you want to transfer files in a "non-interactive" mode, with functions that aren't think-time, see the GetAttachment and PutAttachment functions.

Security Considerations

The FileType parameter is only a suggestion. Specifying it does not enforce specific file types. If you do not want specific file types (such as .exe or .bat) you must write PeopleCode to discern the name and file type of the attached file and delete it.

You may not be able to filter files by file type due to browser limitations. You may have to write your own PeopleCode to do this filtering before you call the browser.

When the end user views attachments using the ViewAttachment function, some browsers treat documents as HTML regardless of file extension, and thus execute embedded Java script. You may want to write a PeopleCode program to only allow specific file extensions to be viewed.

See Also

GetAttachment, PutAttachment.

Select

SelectNew

Think-Time Functions

Parameters

URLDestination

A reference to a URL. This can be either a URL name, in the form URL.URLName, or a string. This is where the file is transferred to.

When you specify a name for the FTP server, the FTP server name can be longer than 30 characters. However, the length of the full URL is limited to 120 characters.

DirAndFileName

A directory and filename. This is appended to the URLDestination to make up the full URL where the file is transferred to.

 

Note. The URLDestination requires "/" (forward) slashes. Because the DirAndFileName parameter is appended to the URL, it also requires only "/" slashes. "\" (backward) slashes are not supported for either the URLDestination or the DirAndFileName parameter.

FileType

A string to use as a suggestion for the extension file type, such as ".doc", ".gif", ".properties" and so on. The user may still type in a filename of a different extension. The value given for this parameter is not enforced. Passing in a null string (that is, two double-quotes with no space ("")) invokes all files (*.*).

UserFile

The name of the file on the source system.

Note. You cannot specify a file name greater than 64 characters.

MaxSize

Specify, in kilobytes, the maximum size of the attachment.

If you specify if 0, it indicates “no limit,” so any filesize can be added. This includes files with zero bytes. This is the default value.

Note. MaxSize is not checked before the file is transferred to the web server.

PreserveCase

Specify a Boolean value to indicate whether the case of the directory and file name specified with DirAndFileName are preserved or not; true, preserve the case, false, convert the filename extension to all lower case letters. The default value is false.

UploadPageTitle

Specify a string value to be displayed on the File Upload page. This string is embedded in the HTML above the file input box. The string can contain HTML elements, and these are visible on the page. Only simple HTML elements should be used, and they should only be incorporated to do basic formatting of the actual data in the string.

Note. The parameter does not automatically handle localization issues. The string passed into the function is the exact string embedded in the page. You and your application are responsible for any translation issues.

Returns

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

Numeric Value

Constant Value

Description

0

%Attachment_Success

File was transferred successfully.

1

%Attachment_Failed

File was not successfully transferred.

2

%Attachment_Cancelled

File transfer didn't complete because the operation was canceled by the user.

3

%Attachment_FileTransferFailed

File transfer didn't succeed.

4

%Attachment_NoDiskSpaceAppServ

No disk space on the application server.

5

%Attachment_NoDiskSpaceWebServ

No disk space on the web server.

6

%Attachment_FileExceedsMaxSize

File exceeds maximum size.

7

%Attachment_DestSystNotFound

Cannot locate destination system for ftp.

8

%Attachment_DestSystFailedLogin

Unable to login to destination system for ftp.

9

%Attachment_FileNotFound

Cannot locate file.

10

%Attachment_DeleteFailed

Cannot delete file.

11

%Attachment_NoFileName

Attachment failed because no file name was specified.

12

%Attachment_FileNameTooLong

Attachment failed because the file name is too long. You can only specify a filename of 64 characters (using the UserFile parameter.)

Example

The following example is how to specify a URL for use with AddAttachment, with encryption, de-referencing the parameter for use with AddAttachment:

The following is for creating the password:

If All(&OPERPSWD) Then OPERPSWD = Encrypt("some value", RTrim(LTrim(&WRKOPERPSWD))); End-If;

The following code example shows how to access the password and enclose it in a URL:

SQLExec("select ftpid, operpswd, ftpaddress, ftpdirectory from PS_CDM_DIST_NODE where distnodename = 'HRFTP'", &FTPID, &OPERPSWD, &ftpaddress, &ftpdirectory); If All(&OPERPSWD) Then &OPERPSWD = Decrypt("some value", RTrim(LTrim(&OPERPSWD))); End-If;

Here is another example.

&uniquefilename = ""; &REC = GetRecord(); For &I = 1 To &REC.FieldCount &Fld = &REC.getfield(&I); If (&Fld.IsKey = True) Then If (&Fld.value = "" And &Fld.IsRequired = True) Then MessageBox(0, "File Attachment Status", 0, 0, "Please attach the file after filling out the required fields on this page."); Return; Else &uniquefilename = &uniquefilename | &Fld.value; End-If; End-If; End-For; &temp = Substitute(&uniquefilename, " ", ""); /* delete spaces */ ATTACHSYSFILENAME = Left(&uniquefilename, 64); /* make uniq part a max of 64 chars */ /* If you have created a subdirectory on the ftp server for this page, prepend it here: ATTACHSYSFILENAME = "HR/ABSENCEHIST/" | ATTACHSYSFILENAME; */ &retcode = AddAttachment(URL.MYFTP, ATTACHSYSFILENAME, "", ATTACHUSERFILE, 0); /* The actual name on the ftp file server is the following */ ATTACHSYSFILENAME = ATTACHSYSFILENAME | ATTACHUSERFILE; &temp = Substitute(ATTACHSYSFILENAME, " ", ""); /* delete spaces */ ATTACHSYSFILENAME = &temp; If (&retcode = %Attachment_Success) Then MessageBox(0, "File Attachment Status", 0, 0, "AddAttachment succeeded"); Hide(ATTACHADD); UnHide(ATTACHVIEW); UnHide(ATTACHDELETE); End-If; If (&retcode = %Attachment_Failed) Then MessageBox(0, "File Attachment Status", 0, 0, "AddAttachment failed"); ATTACHUSERFILE = ""; ATTACHSYSFILENAME = ""; End-If; If (&retcode = %Attachment_Cancelled) Then MessageBox(0, "File Attachment Status", 0, 0, "AddAttachment cancelled"); ATTACHUSERFILE = ""; ATTACHSYSFILENAME = ""; End-If; If (&retcode = %Attachment_FileTransferFailed) Then MessageBox(0, "File Attachment Status", 0, 0, "AddAttachment failed: File Transfer did not succeed"); ATTACHUSERFILE = ""; ATTACHSYSFILENAME = ""; End-If; If (&retcode = %Attachment_NoDiskSpaceAppServ) Then MessageBox(0, "File Attachment Status", 0, 0, "AddAttachment failed: No disk space on the app server"); ATTACHUSERFILE = ""; ATTACHSYSFILENAME = ""; End-If; If (&retcode = %Attachment_NoDiskSpaceWebServ) Then MessageBox(0, "File Attachment Status", 0, 0, "AddAttachment failed: No disk space on the web server"); ATTACHUSERFILE = ""; ATTACHSYSFILENAME = ""; End-If; If (&retcode = %Attachment_FileExceedsMaxSize) Then MessageBox(0, "File Attachment Status", 0, 0, "AddAttachment failed: File exceeds the max size"); ATTACHUSERFILE = ""; ATTACHSYSFILENAME = ""; End-If; If (&retcode = %Attachment_DestSystNotFound) Then MessageBox(0, "File Attachment Status", 0, 0, "AddAttachment failed: Cannot locate destination system for ftp"); ATTACHUSERFILE = ""; ATTACHSYSFILENAME = ""; End-If; If (&retcode = %Attachment_DestSysFailedLogin) Then MessageBox(0, "File Attachment Status", 0, 0, "AddAttachment failed: Unable to login into destination system for ftp"); ATTACHUSERFILE = ""; ATTACHSYSFILENAME = ""; End-If;

See Also

DeleteAttachment, GetAttachment, PutAttachment, ViewAttachment.

Using File Attachments in Applications

Click to jump to top of pageClick to jump to parent topicAddEmailAddress

Syntax

AddEmailAddress(Type, Address [, Primary])

Description

Use the AddEmailAddress function to add an email address for the current user. You can only add one email address of a specific type for a user. If you try to add an email address for a type that is already associated with an email address, you receive an error.

Parameters

Type

Specify the type of email address being added. 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

 

Address

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

Primary

Specify whether this email address is the primary address for the user. This parameter takes a Boolean value: True, this email address is the primary email address, False otherwise. If not specified, the default is False.

Returns

None.

See Also

ChangeEmailAddress, DeleteEmailAddress, MarkPrimaryEmailAddress.

Click to jump to top of pageClick to jump to parent topicAddKeyListItem

Syntax

AddKeyListItem(field, value)

Description

Use the AddKeyListItem to add a new key field and its value to the current list of keys. It enables PeopleCode to help users navigate through related pages without being prompted for key values. A common use of AddKeyListItem is to add a field to a key list and then transfer to a page which uses that field as a key.

Parameters

field

The field to add to the key list.

value

The value of the added key field used in the search.

Returns

Returns a Boolean value indicating whether it completed successfully.

Example

The following example creates a key list using AddKeyListItem and transfers the user to a page named VOUCHER_INQUIRY_FS.

AddKeyListItem(VNDR_INQ_VW_FS.BUSINESS_UNIT, ASSET_ACQ_DET.BUSINESS_UNIT_AP); AddKeyListItem(VNDR_INQ_VW_FS.VOUCHER_ID, ASSET_ACQ_DET.VOUCHER_ID); TransferPage("VOUCHER_INQUIRY_FS");

See Also

ClearKeyList, TransferPage, Transfer.

Click to jump to top of pageClick to jump to parent topicAddSystemPauseTimes

Syntax

AddSystemPauseTimes(StartDay, StartTime, EndDay, EndTime)

Description

Use the AddSystemPauseTimes function to set when pause times occur on your system by adding a row to the system pause-times tables.

This function is used in the PeopleCode for the Message Monitor. Pause times are set up in the Message Monitor.

Parameters

StartDay

Specify a number from 0-6. Values are:

 

Value

Description

0

Sunday

1

Monday

2

Tuesday

3

Wednesday

4

Thursday

5

Friday

6

Saturday

 

StartTime

Specify a time, in seconds, since midnight.

EndDay

Specify a number from 0-6. Values are:

 

Value

Description

0

Sunday

1

Monday

2

Tuesday

3

Wednesday

4

Thursday

5

Friday

6

Saturday

 

EndTime

Specify a time, in seconds, since midnight.

Returns

A Boolean value: True if the system pause time specified was added, False otherwise.

Example

Declare Function SetTime PeopleCode REFRESH_BTN FieldFormula; Component Boolean &spt_changed; Function GetSecond(&time) Returns number ; Return Hour(&time) * 3600 + Minute(&time) * 60 + Second(&time); End-Function; /* initialize; */ STARTDAY = "0"; AMM_STARTTIME = SetTime(0); ENDDAY = "0"; AMM_ENDTIME = SetTime(0); If DoModal(Panel.AMM_ADD_SPTIMES, MsgGetText(117, 13, ""), - 1, - 1) = 1 Then If AddSystemPauseTimes(Value(STARTDAY), GetSecond(AMM_STARTTIME), Value(ENDDAY), GetSecond(AMM_ENDTIME)) Then &spt_changed = True; DoSave(); Else MessageBox(16, MsgGetText(117, 13, ""), 117, 14, ""); End-If; End-If;

See Also

DeleteSystemPauseTimes.

Using the Service Operations Monitor

Click to jump to top of pageClick to jump to parent topicAddToDate

Syntax

AddToDate(date, num_years, num_months, num_days)

Description

Use the AddToDate function to add the specified number of years, months, and days to the date provided.

Suppose, for example, that you want to find a date six years from now. You could not just multiply 6 times 365 and add the result to today’s date, because of leap years. And, depending on the current year, there may be one or two leap years in the next six years. AddToDate takes care of this for you.

You can subtract from dates by passing the function negative numbers.

Considerations Using AddToDate

When you are adding one month to the date provided, and the date provided is the last day of a month, and the next month is shorter, the returned result is the last day of the next month.

For example, in the following, &NewDate is 29/02/2004:

&NewDate = AddToDate("31/01/2004", 0, 1, 0);

When you are adding one month to the date provided, and the date provided is the last day of a month, and the next month is longer, the returned result is not the last day of the next month.

For example, in the following, &NewDate is 29/03/2004.

&NewDate = AddToDate("29/02/2004", 0, 1, 0)

Parameters

date

The input date to be adjusted.

num_years

The number of years by which to adjust the specified date. num_years can be a negative number.

num_months

The number of months by which to adjust the specified date. This parameter can be a negative number.

num_days

The number of days by which to adjust the specified date. This parameter can be a negative number.

Returns

Returns a Date value equal to the original date plus the number of years, months, and days passed to the function.

Example

The following example finds the date one year, three months, and 16 days after a field called BEGIN_DT:

AddToDate(BEGIN_DT, 1, 3, 16);

This example finds the date two months ago prior to BEGIN_DT:

AddToDate(BEGIN_DT, 0, -2, 0);

See Also

DateValue, Day, Days, Days360, Days365, Month, Weekday.

Click to jump to top of pageClick to jump to parent topicAddToDateTime

Syntax

AddToDateTime(datetime, years, months, days, hours, minutes, seconds)

Description

Use the AddToDateTime function to add the specified number of years, months, days, hours, seconds, and minutes to the datetime provided. You can subtract from datetimes by passing the function negative numbers.

Parameters

datetime

The Datetime value to which you want to add.

years

An integer representing the number of years.

months

An integer representing the number of months to add to datetime.

days

An integer representing the number of days to add to datetime.

hours

An integer representing the number of hours to add to datetime.

minutes

An integer representing the number of minutes to add to datetime.

seconds

An integer representing the number of seconds to add to datetime.

Returns

Returns a Datetime value equal to the original date plus the number of years, months, days, hours, minutes, and seconds passed to the function.

Example

The following example postpones an interview scheduled in the INTRTime field by two days and two hours:

INTRTIME = AddToDateTime(INTRTIME, 0, 0, 2, 2, 0, 0);

See Also

AddToTime, DateValue, DateTimeValue, TimeValue.

Click to jump to top of pageClick to jump to parent topicAddToTime

Syntax

AddToTime(time, hours, minutes, seconds)

Description

Use the AddToTime function to add hours, minutes, and seconds to time. This function returns the result as a Time value. To subtract from time, use negative numbers for hours, minutes, and seconds. The resulting value is always adjusted such that it represents an hour less than 24 (a valid time of day.)

Parameters

time

A time value that you want to subtract from or add to.

hours

An integer representing the number of hours to add to time.

minutes

An integer representing the number of minutes to add to time.

seconds

An integer representing the number of seconds to add to time.

Returns

A Time value equal to time increased by the number of hours, minutes, and seconds passed to the function.

Example

Assume that a time, &BREAKTime, is 0:15:00. The following moves the time &BREAKTime back by one hour, resulting in 23:15:00:

&BREAKTime = AddToTime(&BREAKTime, -1, 0, 0);

See Also

AddToDateTime, DateValue, DateTimeValue, TimeValue.

Click to jump to top of pageClick to jump to parent topicAll

Syntax

All(fieldlist)

Where fieldlist is an arbitrary-length list of field names in the form:

[recordname.]fieldname1 [, [recordname.]fieldname2] ...

Description

Use the All function to verify if a field contains a value, or if all the fields in a list of fields contain values. If any of the fields are Null, then All returns False.

A blank character field, or a zero (0) numeric value in a required numeric field is considered a null value.

Related Functions

None

Checks that a field or list of fields have no value.

AllOrNone

Checks if either all the field parameters have values, or none of them have values. Use this in examples where if the user fills in one field, she must fill in all the other related values.

OnlyOne

Checks if exactly one field in the set has a value. Use this when the user must fill in only one of a set of mutually exclusive fields.

OnlyOneOrNone

Checks if no more than one field in the set has a value. Use this in examples when a set of fields is both optional and mutually exclusive; that is, if the user can put a value into one field in a set of fields, or leave them all empty.

Returns

Returns a Boolean value based on the values in fieldlist. The All function returns True if all of the specified fields have a value; it returns False if any one of the fields does not contain a value.

Example

The All function is commonly used in SaveEdit PeopleCode to ensure that a group of related fields are all entered. For example:

If All(RETURN_DT, BEGIN_DT) and 8 * (RETURN_DT - BEGIN_DT) (DURATION_DAYS * 8 + DURATION_HOURS) Then Warning MsgGet(1000, 1, "Duration of absence exceeds standard hours for number of days absent."); End-if;

See Also

AllOrNone, None, OnlyOne, OnlyOneOrNone, SetDefault, SetDefaultAll.

Click to jump to top of pageClick to jump to parent topicAllOrNone

Syntax

AllOrNone(fieldlist)

Where fieldlist is an arbitrary-length list of field references in the form:

[recordname.]fieldname1 [, [recordname.]fieldname2] ...

Description

The AllOrNone function takes a list of fields and returns True if either of these conditions is true:

For example, if field1 = 5, field2 = "Mary", and field3 = null, AllOrNone returns False.

This function is useful, for example, where you have a set of page fields, and if any one of the fields contains a value, then all of the other fields are required also.

A blank character field, or a zero (0) numeric value in a required numeric field is considered a null value.

Related Functions

All

Checks to see if a field contains a value, or if all the fields in a list of fields contain values. If any of the fields is Null, then All returns False.

None

Checks that a field or list of fields have no value. None is the opposite of All.

OnlyOne

Checks if exactly one field in the set has a value. Use this when the user must fill in only one of a set of mutually exclusive fields.

OnlyOneOrNone

Checks if no more than one field in the set has a value. Use this in cases when a set of fields is both optional and mutually exclusive; that is, if the user can put a value into one field in a set of fields, or leave them all empty.

Returns

Returns a Boolean value: True if all of the fields in fieldlist or none of the fields in fieldlist has a value, False otherwise.

Example

You could use AllOrNone as follows:

If Not AllOrNone(STREET1, CITY, STATE) Then WinMessage("Address should consist of at least Street (Line 1), City, State, and Country."); End-if;

See Also

All, None, OnlyOne, OnlyOneOrNone.

Click to jump to top of pageClick to jump to parent topicAllowEmplIdChg

Syntax

AllowEmplIdChg(is_allowed)

Description

By default, the Component Processor does not allow an user to make any changes to a record if a record contains an EMPLID key field and its value matches the value of the user’s EMPLID. In some situations, though, such changes are warranted. For example, you would want employees to be able to change information about themselves when entering time sheet data.

The AllowEmplIdChg function enables the user to change records whose key matches the user’s own EMPLID, or prevents the user from changing these records. The function takes a single Boolean parameter that when set to True allows the employee to update their own data. When the parameter is set to False, the employee is prevented from updating this data.

After permission is granted, it stays through the life of the component, not the page. After a user switches to another component, the default value (not being able to make changes) is reapplied.

Parameters

is_allowed

A Boolean value indicating whether the user is permitted to change the user's own data.

Returns

Optionally returns a Boolean value: True if the function executed successfully, False otherwise.

Example

If Substring (%Page, 1, 9) = Substring(PAGE.TimeSHEET_PNL_A, 1, 9) Then AllowEmplIdChg(true); End-if;

Click to jump to top of pageClick to jump to parent topicAmortize

Syntax

Amortize(intr, pb, pmt, pmtnbr, payintr, payprin, balance)

Description

Use the Amortize function to compute the amount of a loan payment applied towards interest (payintr), the amount of the payment applied towards principal (payprin), and the remaining balance balance, based on the principal balance (pb) at the beginning of the loan term, the amount of one payment pmt, the interest rate charged during one payment period (intr), and the payment number pmtnbr.

Parameters

Note that payintr, payprin, and balance are “outvars”: you must pass variables in these parameters, which the Amortize function then fills with values. The remaining parameters are “invars” containing data the function needs to perform its calculation.

intr

Number indicating the percent of interest charged per payment period.

pb

Principal balance at the beginning of the loan term (generally speaking, the amount of the loan).

pmt

The amount of one loan payment.

pmtnbr

The number of the payment.

payintr

The amount of the payment paid toward interest.

payprin

The amount of the payment paid toward principal.

balance

The remaining balance after the payment.

Returns

None.

Example

Suppose you want to calculate the principal, interest, and remaining balance after the 24th payment on a loan of $15,000, at an interest rate of 1% per loan payment period, and a payment amount of $290.

&INTRST_RT=1; &LOAN_AMT=15000; &PYMNT_AMNT=290; &PYMNT_NBR=24; Amortize(&INTRST_RT, &LOAN_AMT, &PYMNT_AMNT, &PYMNT_NBR, &PYMNT_INTRST, &PYMNT_PRIN, &BAL); &RESULT = "Int=" | String(&PYMNT_INTRST) | " Prin=" | String(&PYMNT_PRIN) | " Bal=" | String(&BAL);

This example sets &RESULT equal to "Int=114 Prin=176 Bal=11223.72".

Click to jump to top of pageClick to jump to parent topicAsin

Syntax

Asin(value)

Description

Use the Asin function to calculate the arcsine of the given value, that is, the size of the angle whose sine is that value.

Parameters

value

Any real number between -1.00 and 1.00 inclusive, the range of valid sine values. If the input value is outside this range, an error message appears at runtime ("Decimal arithmetic error occurred. (2,110)"). Adjust your code to provide a valid input value.

Returns

A value in radians between -pi/2 and pi/2.

Example

The following example returns the size in radians of the angle whose sine is 0.5:

&MY_ANGLE = Asin(0.5);

See Also

Acos, Atan, Cos, Cot, Degrees, Radians, Sin, Tan.

Click to jump to top of pageClick to jump to parent topicAtan

Syntax

Atan(value)

Description

Use the Atan function to calculate the arctangent of the given value, that is, the size of the angle whose tangent is that value.

Parameters

value

Any real number.

Returns

A value in radians between -pi/2 and pi/2.

Example

The following example returns the size in radians of the angle whose tangent is 0.5:

&MY_ANGLE = Atan(0.5);

See Also

Acos, Asin, Cos, Cot, Degrees, Radians, Sin, Tan.

Click to jump to top of pageClick to jump to parent topicBlackScholesCall

Syntax

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

Description

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

Parameters

Asset_Price

The asset price. This parameter takes a decimal value.

Strike_Price

The strike price. This parameter takes a decimal value.

Interest_Rate

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

Years

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

Volatility

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

Returns

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

See Also

BlackScholesPut.

Click to jump to top of pageClick to jump to parent topicBlackScholesPut

Syntax

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

Description

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

Parameters

Asset_Price

The asset price. This parameter takes a decimal value.

Strike_Price

The strike price. This parameter takes a decimal value.

Interest_Rate

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

Years

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

Volatility

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

Returns

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

See Also

BlackScholesCall.

Click to jump to top of pageClick to jump to parent topicBootstrapYTMs

Syntax

BootstrapYTMs(Date, MktInst, Accrual_Conv)

Description

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

Parameters

Date

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

MktInst

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

 

Elements

Description

1

tenor in days

2

yield in percent

3

price per 100 par

4

coupon rate (zero for spot instruments)

5

frequency of coupon payments

6

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

7

coefficient a of a curve interpolating the dataset

8,9,10

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

Returns

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

See Also

Array Class.

Click to jump to top of pageClick to jump to parent topicBreak

Syntax

Break

Description

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

Parameters

None.

Example

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

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

See Also

Evaluate, Exit, For, While.

Click to jump to top of pageClick to jump to parent topicBulkDeleteField

Syntax

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

Description

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

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

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

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

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

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

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

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

Using the Log File

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

Considerations Using this Function

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

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

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

Considerations Using the Exclusion Project

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

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

Parameters

ProjectName

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

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

FieldName

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

ExclProj

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

Returns

A constant value. The values are:

Value

Description

%MDA_Success

Bulk operation completed successfully.

%MDA_Failure

Bulk operation did not complete successfully.

Example

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

See Also

BulkInsertField, BulkModifyPageFieldOrder.

Using the Find In Feature

Performing Bulk Operations

Administering Data

Click to jump to top of pageClick to jump to parent topicBulkInsertField

Syntax

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

Description

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

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

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

Using the Log File

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

Considerations Inserting Fields into Records

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

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

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

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

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

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

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

Considerations Inserting Fields into Pages

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

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

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

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

Considerations Using this Function

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

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

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

Considerations Using the Exclusion Project

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

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

Parameters

ProjectName

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

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

FieldName

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

ModelName

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

ClonePCode

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

ExclProj

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

Returns

A constant value. The values are:

Value

Description

%MDA_Success

Bulk operation completed successfully.

%MDA_Failure

Bulk operation did not complete successfully.

Example

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

See Also

BulkModifyPageFieldOrder, BulkDeleteField.

Performing Bulk Operations

Administering Data

Click to jump to top of pageClick to jump to parent topicBulkModifyPageFieldOrder

Syntax

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

Description

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

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

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

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

This function only reorders fields inside a grid.

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

Note. These changes take affect after components are reloaded.

Using the Log File

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

Considerations Using this Function

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

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

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

Parameters

ProjectName | PageList

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

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

ColNames

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

RequireAll

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

ColWidths

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

Returns

A constant value. The values are:

Value

Description

%MDA_Success

Bulk operation completed successfully.

%MDA_Failure

Bulk operation did not complete successfully.

Example

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

See Also

BulkInsertField, BulkDeleteField.

Performing Bulk Operations

Administering Data

Click to jump to top of pageClick to jump to parent topicBulkUpdateIndexes

Syntax

BulkUpdateIndexes([StringFieldArray])

Description

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

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

SetDBFieldNotUsed(FIELD.OrgId, True);

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

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

Considerations Using this Function

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

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

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

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

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

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

Parameters

StringFieldArray

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

If you don't specify a value for this parameter, the indexes for all records are rebuilt.

Returns

A constant value. The values are:

Value

Description

%MDA_Success

Bulk operation completed successfully.

%MDA_Failure

Bulk operation did not complete successfully.

Example

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

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

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

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

See Also

BulkDeleteField, BulkInsertField, BulkModifyPageFieldOrder.

Click to jump to top of pageClick to jump to parent topicCallAppEngine

Syntax

CallAppEngine(applid [, statereclist, processinstance ]);

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 PeopleSoft 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 PeopleSoft 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.

Note. If you use this function, you shouldn't use the %TruncateTable or %Execute meta-SQL statement in any of your Application Engine steps. This is because on some platforms an implicit commit occurs after these statements, and all online processing should be done as a single logical unit of work.

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.

See Using PeopleCode in Application Engine Programs.

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:

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 use the CallAppEngine function in a PeopleSoft 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.

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:

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:

Parameters

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

Specify the process instance used by the Application Engine runtime.

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);

See Also

DoSaveNow

AESection Class

Refresh

Using PeopleCode in Application Engine Programs

Specifying Call Section Actions

Click to jump to top of pageClick to jump to parent topicCancelPubHeaderXmlDoc

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:

See Also

Cancel

Parameters

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.

See Also

ReSubmitPubHeaderXmlDoc.

Click to jump to top of pageClick to jump to parent topicCancelPubXmlDoc

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:

See Also

Cancel

Parameters

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.

See Also

ReSubmitPubXmlDoc.

Click to jump to top of pageClick to jump to parent topicCancelSubXmlDoc

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:

See Also

Cancel

Parameters

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.

See Also

ReSubmitSubXmlDoc.

Click to jump to top of pageClick to jump to parent topicChangeEmailAddress

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

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

 

Address

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

Returns

None.

See Also

AddEmailAddress, DeleteEmailAddress, MarkPrimaryEmailAddress.

Click to jump to top of pageClick to jump to parent topicChar

Syntax

Char(n)

Description

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

Parameters

n

The numeric value to be converted expressed as a decimal Unicode UTF-16 value.

Returns

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

Example

This example sets &STRING1 to the Latin string “PS” (U+0050, U+0053), &STRING2 to the Unified Han (Japanese, Chinese and Korean) string “&#x65e5&#x672c” (U+65E5, U+672C) and &STRING3 to the Unicode Plane 2 Han character “&#d842&#xdd79” (surrogate pair U+D842, U+DD79 which is equivalent to the UTF-32 scalar value U+20797).

It should be noted that the single character in &STRING3 requires two calls to the Char function as it is a non-BMP Unicode character and therefore is represented by UTF-16 high and low surrogates.


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

See Also

Code, String.

%Substring

Click to jump to top of pageClick to jump to parent topicCharType

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.

See Also

Selecting and Configuring Character Sets and Language Input and Output.

Parameters

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;

See Also

ContainsCharType, ContainsOnlyCharType, ConvertChar.

Selecting and Configuring Character Sets and Language Input and Output

Click to jump to top of pageClick to jump to parent topicChDir

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.

Click to jump to top of pageClick to jump to parent topicChDrive

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.

Click to jump to top of pageClick to jump to parent topicCheckMenuItem

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.

Click to jump to top of pageClick to jump to parent topicClean

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 returns 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.

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));

See Also

Char, String.

%Substring

Click to jump to top of pageClick to jump to parent topicClearKeyList

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( );

See Also

AddKeyListItem.

Click to jump to top of pageClick to jump to parent topicClearSearchDefault

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.

See Also

SearchDefault.

Accessing the Data Buffer

Parameters

[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. The recordname prefix is required if the call to ClearSearchDefault is in a record definition other than recordname.

Returns

Optionally returns a Boolean value indicating whether the function succeeded.

See Also

ClearSearchEdit, SetSearchDefault, SetSearchEdit, SetSearchDialogBehavior.

Search Processing in Update Modes

Click to jump to top of pageClick to jump to parent topicClearSearchEdit

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.

See Also

SearchEdit.

Accessing the Data Buffer

Parameters

[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 required if the call to ClearSearchEdit is in a record definition other than recordname.

Returns

Optionally returns a Boolean value indicating whether the function succeeded.

See Also

SetSearchEdit, SetSearchDefault, ClearSearchDefault, SetSearchDialogBehavior.

Search Processing in Update Modes

Click to jump to top of pageClick to jump to parent topicCode

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.

See Also

Char, String.

%Substring

Click to jump to top of pageClick to jump to parent topicCodeb

Syntax

Codeb(str)

Description

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

See Also

Code.

Click to jump to top of pageClick to jump to parent topicCollectGarbage

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 don't 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.

See Also

Application Classes.

Click to jump to top of pageClick to jump to parent topicCommitWork

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.

See CallAppEngine.

FieldChange and SavePreChange Considerations

The following are the FieldChange and SavePreChange considerations:

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:

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;

See Also

Using PeopleCode in Application Engine Programs.

Click to jump to top of pageClick to jump to parent topicCompareLikeFields

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.

See Also

CompareFields.

Accessing the Data Buffer

Specifying Data with References Using Scroll Path Syntax and Dot Notation

Parameters

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;

See Also

CopyFields.

Click to jump to top of pageClick to jump to parent topicComponent

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

data_type

Specify a PeopleCode data type.

&var_name

A legal variable name.

Example

Component string &PG_FIRST;

See Also

Local, Global.

Data Types

Click to jump to top of pageClick to jump to parent topicComponentChanged

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;

Click to jump to top of pageClick to jump to parent topicConnectorRequest

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.

See Also

ConnectorRequest

Parameters

&Message

Specify an already instantiated message.

Returns

A nonrowset-based message object.

See Also

ConnectorRequestURL

Click to jump to top of pageClick to jump to parent topicConnectorRequestURL

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.

See Also

ConnectorRequestUrl

Parameters

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

See Also

ConnectorRequest

Click to jump to top of pageClick to jump to parent topicContainsCharType

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

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;

See Also

ContainsCharType, ContainsOnlyCharType, ConvertChar.

Selecting and Configuring Character Sets and Language Input and Output

Click to jump to top of pageClick to jump to parent topicContainsOnlyCharType

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

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

See Also

CharType, ContainsCharType, ConvertChar.

Selecting and Configuring Character Sets and Language Input and Output

Click to jump to top of pageClick to jump to parent topicContinue

Syntax

Continue

Description

Use the Continue statement to continue execution in a loop. How the statement performs depends on the type of 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);

See Also

Break, Exit.

Click to jump to top of pageClick to jump to parent topicConvertChar

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:

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

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)

 

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

See Also

CharType, ContainsCharType, ContainsOnlyCharType.

Selecting and Configuring Character Sets and Language Input and Output

Click to jump to top of pageClick to jump to parent topicConvertCurrency

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.

See Also

Controlling Currency Display Format.

Parameters

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);

Click to jump to top of pageClick to jump to parent topicConvertDatetimeToBase

Syntax

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

Description

Use the ConvertDatetimeToBase function to convert the text value textdatetime to a datetime value, then further converts it to the base time. This function automatically calculates whether daylight savings time is in effect for the given textdatetime.

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

Parameters

textdatetime

Specify a datetime value represented as text (for example, "01/01/1999 3:00 PM")

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, &DATETIMEVAL would have a datetime value of "01-01-1999-07:00:00.000000", assuming the Base time (as defined in PSOPTIONS) was PST.

&DATETIMEVAL= ConvertDateTimeToBase("01/01/1999 10:00:00AM", "EST");

See Also

ConvertTimeToBase, FormatDateTime, IsDaylightSavings, DateTimeToTimeZone, TimeToTimeZone, TimeZoneOffset.

Using PeopleTools Utilities

Click to jump to top of pageClick to jump to parent topicConvertRate

Syntax

ConvertRate(Rate, In_Frequency, Out_Frequency)

Description

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

Parameters

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

 

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);

See Also

RoundCurrency.

Click to jump to top of pageClick to jump to parent topicConvertTimeToBase

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 savings 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 savings time. The date used to calculate whether daylight savings time is in effect is the current date.

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

Parameters

texttime

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

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 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");

See Also

ConvertDatetimeToBase, FormatDateTime, IsDaylightSavings, DateTimeToTimeZone, TimeToTimeZone, TimeZoneOffset.

Using PeopleTools Utilities

Click to jump to top of pageClick to jump to parent topicCopyAttachments

Syntax

CopyAttachments(URLSource, URLDestination [, Record_Names [, PreserveCase]])

where URLSource and URLDestination can have one of the following forms:

URL.URLname

or a string URL, such as

ftp://user:password@ftp.ps.com/

Note. You cannot specify a different port for an attachment when using an FTP server. You can only use the default port of 21.

Note. The file attachment functionality does not support SFTP or FTPS.

Description

Use the CopyAttachments function to copy files from one system to another.

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

Parameters

Source

Specify the source location of the files to be moved. This parameter can either be a URL name in the form URL .URLName, or a string.

Destination

Specify the destination of the files being moved. This parameter can either be a URL name in the form URL .URLName, or a string.

Record_Names

Specify an array of record names that store valid references to files located on the system specified by Source. If you don't specify this parameter, all the records that contain the field ATTACHSYSFILENAME are used (that is, this function tries to get the attachments based on all those references from Source).

PreserveCase

Specify a Boolean value to indicate whether the case of the directory and file name specified with DirAndFileName are preserved or not; true, preserve the case, false, convert the filename extension to all lower case letters. The default value is false.

Returns

You can check for either a constant or a number value. The values are:

Numeric Value

Constant Value

Description

0

%Attachment_Success

File was transferred successfully.

1

%Attachment_Failed

File was not successfully transferred.

3

%Attachment_FileTransferFailed

File transfer didn't succeed.

7

%Attachment_DestSystNotFound

Cannot locate destination system.

8

%Attachment_DestSystFailedLogin

Unable to login to destination system.

9

%Attachment_FileNotFound

Cannot locate file.

10

%Attachment_DeleteFailed

Cannot delete file.

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, "CopyAttachmentArchive succeeded"); Else MessageBox(0, "Copy Archive Status", 0, 0, "CopyAttachmentArchivefailed"); End-If;

See Also

AddAttachment, DeleteAttachment, GetAttachment, PutAttachment, ViewAttachment.

Using File Attachments in Applications

Copy File Attachments

Click to jump to top of pageClick to jump to parent topicCopyFields

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.

See Also

CopyFieldsTo, CopyChangedFieldsTo, CopyTo.

Accessing the Data Buffer

Specifying Data with References Using Scroll Path Syntax and Dot Notation

Parameters

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);

See Also

CompareLikeFields.

Specifying Data with References Using Scroll Path Syntax and Dot Notation

Click to jump to top of pageClick to jump to parent topicCopyFromJavaArray

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.

See Also

Java Class

PeopleCode and Java Data Types Mapping

Parameters

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);

See Also

CopyToJavaArray, CreateJavaArray.

Array Class

Java Class

Click to jump to top of pageClick to jump to parent topicCopyRow

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.

See Also

CopyTo, CopyFieldsTo, CopyChangedFieldsTo.

Accessing the Data Buffer

Parameters

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);

Click to jump to top of pageClick to jump to parent topicCopyToJavaArray

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.

See Also

Java Class

PeopleCode and Java Data Types Mapping

Parameters

&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);

See Also

CopyFromJavaArray, CreateJavaArray.

Array Class

Java Class

Click to jump to top of pageClick to jump to parent topicCos

Syntax

Cos(angle)

Description

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

Parameters

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);

See Also

Acos, Asin, Atan, Cot, Degrees, Radians, Sin, Tan.

Click to jump to top of pageClick to jump to parent topicCot

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

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);

See Also

Acos, Asin, Atan, Cos, Degrees, Radians, Sin, Tan.

Click to jump to top of pageClick to jump to parent topicCreateAnalyticInstance

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

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 don't 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);

See Also

GetAnalyticInstance

Understanding the Analytic Calculation Engine Classes

Application Classes

Creating Analytic Type Definitions

Click to jump to top of pageClick to jump to parent topicCreateArray

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

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:

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.

See Also

CreateArrayRept, Split.

Array Class

Using Flattening and Promotion

Click to jump to top of pageClick to jump to parent topicCreateArrayAny

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 don't specify any parameters with CreateArrayAny, it's the same as using the CreateArray function without any parameters.

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

Parameters

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.

See Also

CreateArrayRept, CreateArray, Split.

Array Class

Using Flattening and Promotion

SQL Class

Click to jump to top of pageClick to jump to parent topicCreateArrayRept

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

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);

See Also

CreateArray, Split.

Array Class

Clone

Click to jump to top of pageClick to jump to parent topicCreateDirectory

Syntax

CreateDirectory(path, [, pathtype])

Description

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

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

Working with Relative Paths

If you specify a relative path, that path is appended to the path specified by an environmental variable, if the variable exists, in a particular order. This means if the first environmental variable in order is found, that is the one that's used. If it isn't found, the next one is searched for, and if found, is used, and so on.

The environmental variables that get used are different, depending on whether the machine where the code is running is an application server or not. If the code is running on an application server, the following environmental variables are valid, and are searched for in the following order:

  1. PS_FILEDIR[\relative_path]

  2. PS_SERVDIR\Files[\relative_path]

If the code is not running on an application server, the following environmental variables are valid, and are searched for in the following order:

  1. PS_FILEDIR[\relative_path]

  2. PS_SERVDIR\Files[\relative_path]

  3. TEMP[\relative_path]

The PS_FILEDIR environmental variable is not initialized and set to a path automatically. To use this environmental variable, you must set it yourself.

Note. Your system security should verify if a user has the correct permissions before allowing access to a drive (for example, if a user changes their TEMP environmental variable to a network drive they don’t normally have access to, your system security should detect this.)

Parameters

path

Specify the path to be created.

pathtype

Specify whether the path is an absolute or relative path. The values for this parameter are:

  • %FilePath_Relative (default)

  • %FilePath_Absolute

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

If pathtype 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 PeopleCode runtime automatically converts platform-specific separator characters to the appropriate form for where your PeopleCode program is executing. On a WIN32 system, UNIX "/" separators are converted to "\", and on a UNIX system, WIN32 "\" separators are converted to "/".

Note. The syntax of the path only depends on the platform where your PeopleCode is executing.

Returns

None.

Example

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

See Also

FileExists, FindFiles, GetFile, GetAttachment, PutAttachment, RemoveDirectory.

File Class

Click to jump to top of pageClick to jump to parent topicCreateException

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

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;

See Also

Exception Class.

Click to jump to top of pageClick to jump to parent topicCreateJavaArray

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 don't 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

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

See Also

CreateJavaObject, GetJavaClass.

Java Class

Click to jump to top of pageClick to jump to parent topicCreateJavaObject

Syntax

CreateJavaObject(ClassName [ConstructorParams])

Where ConstructorParams has the form

Arguement1 [, arguement2] . . .

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 CreateJavaObject, it must be located in a directory specified in the PS_CLASSPATH environment variable or in the <PS_HOME>/appserv/classes directory.

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

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;

See Also

CreateJavaArray, GetJavaClass.

Java Class

Click to jump to top of pageClick to jump to parent topicCreateMCFIMInfo

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

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.

See Also

MCFIMInfo Class

Click to jump to top of pageClick to jump to parent topicCreateMessage

Syntax

CreateMessage(OPERATION.messagename [, 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:

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

OPERATION. messagename

Specify the name of the message definition you want to create a message object for.

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

Returns a reference to a message object.

Example

The following example creates a request message &MSG assocaited with the service operation PURCHASE_ORDER.

Local message &MSG; &MSG = CreateMessage(OPERATION.PURCHASE_ORDER);

See Also

GetMessage, GetPubContractInstance, GetSubContractInstance.

Message Classes

Click to jump to top of pageClick to jump to parent topicCreateObject

Syntax

CreateObject(str_class_name, create_par, . . .)

Where str_class_name either:

—identifies a class by class name

—identifies 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 Using 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.

Considerations Using PeopleCode Built-in Objects

For example, to generate a Peoplesoft 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

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"); ObjectDoMethod(&WORKBOOKS, "Add", "C:\TEMP\INVOICE.XLT"); /* This associates the INVOICE template w/the workbook */ 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;

See Also

ObjectDoMethod, ObjectGetProperty, ObjectSetProperty, CreateObjectArray, ObjectDoMethodArray.

Chart Class

Internet Script Classes (iScript)

Using OLE Functions

Click to jump to top of pageClick to jump to parent topicCreateObjectArray

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

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);

See Also

CreateObject, ObjectDoMethod, ObjectGetProperty, ObjectSetProperty, ObjectDoMethodArray.

Array Class

Using OLE Functions

Click to jump to top of pageClick to jump to parent topicCreateProcessRequest

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

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);

See Also

ProcessRequest Class

Schedule

Click to jump to top of pageClick to jump to parent topicCreateRecord

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

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 */

See Also

GetRecord, GetField.

Record Class

Accessing the Data Buffer

Click to jump to top of pageClick to jump to parent topicCreateRowset

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:

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:

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

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);

See Also

GetRowset, GetLevel0, GetRecord, GetField.

Using Standalone Rowsets

Click to jump to top of pageClick to jump to parent topicCreateRowsetCache

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

&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");

See Also

GetRowsetCache

RowsetCache Class

Click to jump to top of pageClick to jump to parent topicCreateSOAPDoc

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();

See Also

SOAPDoc Class.

XmlDoc Class

Click to jump to top of pageClick to jump to parent topicCreateSQL

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.

&Sql1 = CreateSql("Select * from " | &TableName); &AAny = CreateArrayAny(); While &Sql1.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

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

None.

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(......); /* do the deed */

See Also

DeleteSQL, FetchSQL, GetSQL, SQLExec, StoreSQL.

SQL Class

Open

Click to jump to top of pageClick to jump to parent topicCreateWSDLMessage

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.

See Also

Consuming Services

Click to jump to top of pageClick to jump to parent topicCreateXmlDoc

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:

Parameters

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("");

See Also

XmlDoc Class.

Click to jump to top of pageClick to jump to parent topicCubicSpline

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

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.

 

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.

See Also

HermiteCubic, LinearInterp.

Click to jump to top of pageClick to jump to parent topicCurrEffDt

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.

See Also

EffDt, GetCurrEffRow, EffSeq.

Accessing the Data Buffer

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;

See Also

CurrEffRowNum, CurrEffSeq, CurrentLevelNumber.

Click to jump to top of pageClick to jump to parent topicCurrEffRowNum

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.

See Also

RowNumber, GetCurrEffRow.

Accessing the Data Buffer

Example

&ROW = CurrEffRowNum(1);

See Also

CurrEffSeq, CurrentLevelNumber, CurrEffRowNum.

Click to jump to top of pageClick to jump to parent topicCurrEffSeq

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.

See Also

EffSeq, GetCurrEffRow, DeleteEnabled.

Accessing the Data Buffer

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;

See Also

CurrEffDt, CurrentLevelNumber, CurrEffRowNum.

Click to jump to top of pageClick to jump to parent topicCurrentLevelNumber

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();

See Also

CurrentRowNumber, FetchValue.

Click to jump to top of pageClick to jump to parent topicCurrentRowNumber

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.

See Also

GetRow, RowNumber.

Accessing the Data Buffer

Parameters

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;

See Also

ActiveRowCount, CurrentLevelNumber, FetchValue.

Click to jump to top of pageClick to jump to parent topicDate

Syntax

Date(date_num)

Description

The Date function takes a number in the form YYYYMMDD and returns a corresponding Date value. If the date is invalid, Date displays an error message.

Warning! Make sure that you pass a four-digit year in the year parameter of this function. Two-digit values are interpreted literally: 93, for example, represents the year 93 AD.

Returns

Returns a date equal to the date specified in date_num.

Example

Set the temporary variable &HIREDate to a date field containing the date July 1, 1997:

&HIREDate = Date(19970701);

See Also

Date3, DateValue, Day, Days360, Days365, Month, Weekday, Year.

Click to jump to top of pageClick to jump to parent topicDate3

Syntax

Date3(year, month, day)

Description

The Date3 function accepts a date expressed as three integers: year, month, and day. It returns a corresponding Date value. If the date is invalid, the Date3 displays an error message.

Warning! Make sure that you pass a four-digit year in the year parameter of this function. Two-digit values will be interpreted literally: 93, for example, represents the year 93 AD.

Parameters

year

An integer for the year in the form YYYY.

month

An integer from 1 to 12 designating the month.

day

An integer from 1 to 31 designating the day of the month.

Returns

Returns a Date value equal to the date specified in the function parameters.

Example

The following PeopleCode Date3 function returns the first day of the year in which the employee was hired:

Date3(HIRE_YEAR, 1, 1);

See Also

Date, DateValue, Day, Days360, Days365.

Click to jump to top of pageClick to jump to parent topicDatePart

Syntax

DatePart(datetime_value)

Description

Use the DatePart function to determine a date based on a provided DateTime value.

Returns

Returns a Date value equal to the date part of a specified DateTime value.

Example

The following statement sets &D2 to a Date value for 11/12/1997:

&D1 = DateTimeValue("11/12/1997 10:23:15 AM"); &D2 = DatePart(&D1);

Click to jump to top of pageClick to jump to parent topicDateTime6

Syntax

DateTime6(year, month, day, hour, minute, second)

Description

The DateTime6 function returns a DateTime value based on integer values for the year, month, day, hour, minute, and second. If the result of this function is not an actual date, there is a runtime error.

Warning! Make sure that you pass a four-digit year in the year parameter of this function. Two-digit values will be interpreted literally: 93, for example, represents the year 93 AD.

Parameters

year

A four-digit number representing the year.

month

A number between 1 and 12 representing the month.

day

A number representing the day of the month.

hour

A number from 0 to 23 representing the hour of the day.

minute

A number from 0 to 59 representing the minute of the hour.

second

A number from 0 to 59.999999 representing seconds.

Returns

Returns a DateTime value based on the integers provided.

Example

The following example sets &DT to a DateTime value equal to 10:09:20 on March 15, 1997:

&DT = DateTime6(1997, 3, 15, 10, 9, 20);

Click to jump to top of pageClick to jump to parent topicDateTimeToHTTP

Syntax

DateTimeToHTTP(datetime)

Description

Use the DateTimeToHTTP function to convert any datetime value to a datetime string in the format specified by HTTP 1.0 and 1.1 standards.

Note. Because the HTTP protocol is used to interchange information between diverse computing systems, the value returned from this function is always the ”US English” form of weekdays and months. If you want the value to use the localized form, use the DateTimeToLocalizeString function instead.

The standard HTTP datetime has the following fixed length format:

<dow><,><sp><dd><sp><mon><sp><year><sp><hh><:><mm><:><ss><sp><GMT>

where:

Value

Description

<dow>

a 3-character day of week name, one of Sun, Mon, Tue, Wed, Thu, Fri, Sat.

<,>

a literal comma character

<sp>

a literal space character

<dd>

a 2-digit day of month, such as 02 or 22.

<mon>

is a 3-character month name, one of Jan, Feb, Mar, and so on.

<year>

a 4-digit year number

<hh>

a 24-hour hour number, such as 00 or 13

<mm>

a 2-digit minute number, such as 01 or 56

<ss>

a 2-digit second number, such as 03 or 59

<GMT>

a literal 3-character GMT.

As indicated by the trailing GMT, this datetime format is always expressed in GMT (or UTC, which is declared to be the same for the purposes of HTTP).

Parameters

datetime

Specify the datetime value you want converted to HTTP format. This datetime is assumed to be in the base timezone of the installation.

Returns

A string containing the converted datetime.

Example

&gmtdate = DateTimeToHTTP(AddToDateTime(%DateTime, 0,0,0,0,600,0)); %Response.setHeader("Last-Modified", &gmtdate);

See Also

AddToDateTime, DateTimeToLocalizedString, FormatDateTime.

Click to jump to top of pageClick to jump to parent topicDateTimeToLocalizedString

Syntax

DateTimeToLocalizedString({datetime | date}, [Pattern])

Description

Use the DateTimeToLocalizedString function to convert either datetime or date to a localized string. You can also specify a particular pattern to convert datetime or date to.

The Pattern is optional. Only specify Pattern if necessary.

If you need to change the pattern for each language, change the first message in Message Catalog set number 138. This is a format for each language.

Parameters

Datetime | Date

Specify either the datetime or date that you want to convert.

Pattern

Specify the pattern you want to the localized datetime or date to be converted to.

Using the Pattern Parameter

Pattern takes a string value, and indicates how you want the date or datetime converted.

The valid values for Pattern are as follows.

Note. The values for pattern are case-sensitive. For example, if you specify a lowercase m, you get minutes, while an uppercase M displays the month.

Symbol

Definition

Type

Example

G

Era designator

Text

AD

y

Year

Number

1996

M

Month in year

Text&Number

July&07

d

Day in month

Number

10

h

Hour in am/pm

Number (1-12)

12

H

Hour in day

Number (0-23)

0

m

Minute in hour

Number

30

s

Second in minute

Number

55

S

Millisecond

Number

978

E

Day in week

Text

Tuesday

a

am/pm marker

Text

PM

k

Hour in day

Number (1-24)

24

K

Hour in am/pm

Number (0-11)

0

'

Escape for text

Delimiter

 

''

Single quote

Literal

'

The number of pattern letters determine the format.

Type

Pattern Format

Text

If 4 or more pattern letters are used, the full form is used. If less than 4 pattern letters are used, the short or abbreviated form is used if one exists.

Number

Use the minimum number of digits. Shorter numbers are zero-padded to this amount.

The year is handled specially; that is, if the count of 'y' is 2, the year is truncated to 2 digits.

Text&Number

If 3 or more pattern letters are used, text is used, otherwise, a number is used.

Any characters in Pattern are not in the ranges of ['a'..'z'] and ['A'..'Z'] are treated as quoted text. For instance, characters like ':', '.', ' ', '#' and '@' appear in the resulting string even they're not within single quotes.

A pattern containing any invalid pattern letter results in a runtime error.

Examples using a United States locale:

Pattern

Result

"yyyy.MM.dd G 'at' hh:mm:ss"

1996.07.10 AD at 15:08:56

"EEE, MMM d, ''yy"

Wed, July 10, '96

"h:mm a"

12:08 PM

"hh 'o''clock' a"

12 o'clock PM

"K:mm a"

0:00 PM

"yyyyy.MMMMM.dd GGG hh:mm aaa"

1996.July.10 AD 12:08 PM

Returns

A string.

Example

REM**************************************************************; Function ConvertDateToDTTM(&Date As date) Returns datetime ; REM ***********************************************************; &String = DateTimeToLocalizedString(&Date, "M/d/y"); &String = &String | " 00:00:00.000000"; &DateTime = DateTimeValue(&String); Return &DateTime; End-Function;

See Also

FormatDateTime, DateTimeToHTTP.

Click to jump to top of pageClick to jump to parent topicDateTimeToTimeZone

Syntax

DateTimeToTimeZone(OldDateTime, SourceTimeZone, DestinationTimeZone)

Description

Use the DateTimeToTimeZone function to convert datetimes from the datetime specified by SourceTimeZone to the datetime specified by DestinationTimeZone.

Considerations Using this Function

Typically, this function is used in PeopleCode, not for displaying time. If you take a datetime value, convert it from base time to client time, then try to display this time, depending on the user settings, when the time is displayed the system might try to do a second conversion on an already converted datetime. This function could be used as follows: suppose a user wanted to check to make sure a time was in a range of times on a certain day, in a certain timezone. If the times were between 12 AM and 12 PM in EST, these resolve to 9 PM and 9 AM PST, respectively. The start value is after the end value, which makes it difficult to make a comparison. This function could be used to do the conversion for the comparison, in temporary fields, and not displayed at all.

Parameters

OldDateTime

Specify the datetime value to be converted.

SourceTimeZone

Specify the time zone that OldDateTime is in. Valid values are:

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

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

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

DestinationTimeZone

Specify the time zone that you want to convert OldDateTime to. Valid values are:

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

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

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

Returns

A converted datetime value.

Example

The following example. TESTDTTM, is a datetime field with a value 01/01/99 10:00:00. This example converts TESTDTTM from Pacific standard time (PST) to eastern standard time (EST).

&NEWDATETIME = DateTimeToTimeZone(TESTDTTM, "PST", "EST");

&NEWDATETIME will have the value 01/01/99 13:00:00 because EST is three hours ahead of PST on 01/01/99, so three hours are added to the datetime value.

See Also

ConvertDatetimeToBase, ConvertTimeToBase, FormatDateTime, IsDaylightSavings, TimeToTimeZone, TimeZoneOffset.

Using PeopleTools Utilities

Click to jump to top of pageClick to jump to parent topicDateTimeValue

Syntax

DateTimeValue(string)

where string has the format:

MM/DD/YY[YY] hh:mm:ss.ssssss [{AM|PM}]

or

MM.DD.YY[YY] hh:mm:ss.ssssss [{AM|PM}]

Description

Use the DateTimeValue function to derive a DateTime value from a string representing a date and time.

Using this Function in Fields Without a Default Century Setting

This function may derive the wrong century setting if passed a 2-character year and DateTimeValue is executing in a PeopleCode event not associated with a field that has a default century setting.

For example, assume that TEST_DATE is a date field with a default century setting of 10. TEST_FIELD is a field with no default century setting. If the following PeopleCode program is executing in TEST_FIELD, the date will be calculated incorrectly:

TEST_DATE = DateTimeValue("10/13/11 15:34:25");

Though TEST_DATE has a century setting, it isn’t used because the PeopleCode fired in TEST_FIELD. Instead, DateTimeValue uses the 50/50 rule and calculates the year to be 2011 (instead of 1911).

Returns

Returns a DateTime value.

Example

Both of the following examples set &Date_TIME to a Datetime value equal to October 13, 1997 10:34:25 PM.

&Date_TIME = DateTimeValue("10/13/97 10:34:25 PM"); &Date_TIME = DateTimeValue("10/13/97 22:34:25");

See Also

Date, Date3, DateValue, Day, Days360, Days365, Month, Weekday, Year.

Click to jump to top of pageClick to jump to parent topicDateValue

Syntax

DateValue(date_str)

Description

Use the DateValue function to convert a date string and returns the result as a Date type. date_str must be a string in the active date format user's current personalization date format.

If the user's Date Format personalization setting is set to DDMMYY (or it is defaulted to this from their browser locale or the system-wide personalization defaults) then the following code returns a Datetime value equal to September 10, 1997.

&DTM = DateValue("10/09/97");

If the user's Date Format personalization setting is set to MMDDYY (or it is defaulted to this from their browser locale or the system-wide personalization defaults) then the same function call returns a value equal to October 9, 1997.

Using this Function in Fields Without a Default Century Setting

This function may derive the wrong century setting if passed a 2-character year and DateValue is executing in a PeopleCode event not associated with a field that has a default century setting.

For example, assume that TEST_DATE is a date field with a default century setting of 10. TEST_FIELD is a field with no default century setting. If the following PeopleCode program is executing in TEST_FIELD, the date will be calculated incorrectly:

TEST_DATE = DateValue("10/13/11");

Though TEST_DATE has a century setting, it isn’t used because the PeopleCode fired in TEST_FIELD. Instead, DateValue uses the 50/50 rule and calculates the year to be 2011 (instead of 1911).

Returns

Returns a Date value.

See Also

Date, Date3, DateTimeValue, Day, Days360, Days365, Month, Weekday, Year.

Click to jump to top of pageClick to jump to parent topicDay

Syntax

Day(dt_val)

Description

Use the Day function to determine an integer representing the day of the month based on a Date or DateTime value.

Returns

Returns a Number value equal to the day of the month for dt_val. The return value is an integer from 1 to 31.

Example

If HIRE_DATE is November, 1, 1997, the following Day function returns the integer 1:

&FIRST_DAY = Day(HIRE_DATE);

See Also

Date, Date3, DateValue, Days, Days360, Days365, Month, Weekday, Year.

Click to jump to top of pageClick to jump to parent topicDays

Syntax

Days(dt_val)

Description

Use the Days function to returns the Julian date for the dt_val specified. This function accepts a Date, DateTime, or Time value parameter.

Returns

Returns a Number value equal to the Julian date for dt_val.

Example

To find the number of days between two dates, use the Days function on both dates, and subtract one from the other:

&NUM_DAYS = Abs(Days(HIRE_Date) - Days(RELEASE_Date));

See Also

DateValue, Days360, Days365, Month, Weekday, Year.

Click to jump to top of pageClick to jump to parent topicDays360

Syntax

Days360(date_val1, date_val2)

Description

Use the Days360 function to return the number of days between the Date values date_val1 and date_val2 using a 360-day year (twelve 30-day months). Use this function to help compute payments if your accounting system is based on twelve 30-day months.

If date_val2 occurs before date_val1, Days360 returns a negative number.

Example

The following example sets &NUMDAYS to the number of days between TERM_START_DT and PMT_DT based on a 360-day calendar:

&NUMDAYS = Days360(TERM_START_DT, PMT_DT);

See Also

Date, Date3, DateValue, Day, Days, Days365, Month, Weekday, Year.

Click to jump to top of pageClick to jump to parent topicDays365

Syntax

Days365(date_val1, date_val2)

Description

Use the Days365 function to return the number of days between the Date values date_val1 and date_val2 using a 365-day year. Use this function to help compute payments if your accounting system is based on a 365-day year.

If date_val2 occurs before date_val1, Days365 returns a negative number.

Returns

Returns a Number value equal to the number of days between the two dates in a 365-day calendar.

Example

The following example sets &NUMDAYS to the number of days between and TERM_START_DT and PMT_DT, based on a 365-day calendar:

&NUMDAYS = Days360(TERM_START_DT, PMT_DT);

See Also

Date, Date3, DateValue, Day, Days360, Month, Weekday, Year.

Click to jump to top of pageClick to jump to parent topicDBCSTrim

Syntax

DBCSTrim(source_str)

Description

Note. This function has been deprecated.

Use the DBCSTrim function to remove a trailing DBCS lead byte at the end of the string.

Click to jump to top of pageClick to jump to parent topicDBPatternMatch

Syntax

DBPatternMatch(Value, Pattern, CaseSensitive)

Description

Use the DBPatternMatch function to match the string in Value to the given pattern.

You can use wildcard characters % and _ when searching. % means find all characters, while _ means find a single character. For example, if you wanted to find if the string in Value started with the letter M, you'd use "M%" for Pattern. If you wanted to find either DATE or DATA, use "DAT_" for Pattern.

These characters can be escaped (that is, ignored) using a \. For example, if you want to search for a value that contains the character %, use \% in Pattern.

If Pattern is an empty string, this function retrieves the value just based on the specified case-sensitivity (that is, specifying "" for Pattern is the same as specifying "%").

Parameters

Value

Specify the string to be searched.

Pattern

Specify the pattern to be used when searching.

CaseSensitive

Specify whether the search is case-sensitive. This parameter takes a Boolean value: True, the search is case-sensitive, False, it is not.

Returns

Returns a Boolean value. True if the string matches the pattern, False otherwise.

See Also

Find, Findb.

Click to jump to top of pageClick to jump to parent topicDeclare Function

Syntax

PeopleCode Function Syntax

Declare Function function_name PeopleCode record_name.field_name event_type

External Function Syntax

Declare Function function_name Library lib_name [ALIAS module_name ] [paramlist] [RETURNS ext_return_type [As pc_type]]

Where paramlist is:

([ext_param1 [, ext_param2] . . .)

and where ext_paramn is:

ext_datatype [{REF|VALUE}] [As pc_return_type]

Description

PeopleCode can call PeopleCode functions defined in any field on any record definition. You can create special record definitions whose sole purpose is to serve as function libraries. By convention, PeopleCode functions are stored in FieldFormula PeopleCode, in record definitions with names beginning in FUNCLIB_.

PeopleCode can also call external programs that reside in dynamic link libraries. You must declare either of these types of functions at the top of the calling program using the Declare Function statement.

To support processes running on an application server, you can declare and call functions compiled in dynamic link libraries on windows (*.DLL files) and shared libraries on UNIX (lib*.so files.) The PeopleCode declaration and function call syntax is the same regardless of platform, but UNIX libraries must be compiled with an interface function.

See Calling DLL Functions on the Application Server.

PeopleCode Functions

You can call a PeopleCode function defined on any record definition, provided you declare it at the top of the calling program. The declaration identifies the function name, as well as the record, field, and event type where the function definition resides. The function parameters and return type are not declared; they are determined from the function definition.

Note. You can define functions only in Record Field PeopleCode. You can’t define functions in Component PeopleCode, Component Record Field PeopleCode, and so on.

External Library Functions

Function declarations define routines in an external (C-callable) library. The function declaration provides the name of the library, an optional alias module_name, a list of parameters to pass to the function, an optional Returns clause specifying the type of any value returned by the external function, and the PeopleCode data type into which to convert the returned value. The library must be a DLL accessible by Windows or a shared library accessible by UNIX.

After you have declared an external library function, you can call it the same way as an external PeopleCode function. Like PeopleCode functions, you must pass the number of parameters the library function expects. Calls to external functions suspend processing: this means that you should exercise caution to avoid “think-time” errors when calling the function in the following PeopleCode events:

See Think-Time Functions.

Parameters

The following are the parameters for the PeopleCode Function syntax:

function_name

Name of the function.

PeopleCode

Reserved word that identifies the function as a PeopleCode function.

recordname.fieldname

Specifies the record and field where the function is located.

event_type

Component Processor event with which the function is associated.

Note. event_type can be used to specify record field events only. You can’t specify a component record field event, a component record event, and so on.

The following are the parameters for the External Function syntax:

function_name

Name of the function.

Library

Reserved word that identifies the function as an external library function.

lib_name

A string representing the name of the external library. The external routine must be located in a DLL named lib_name accessible by Windows, or an equivalent shared library in a UNIX system.

Alias module_name

Optionally specifies the name of the function’s entry point within the shared library. This is needed only if the C function name differs from function_name in the PeopleCode external function declaration. The external module is invoked using the __stdcall calling convention on Windows.

Paramlist

List of parameters expected by the function, each in the form:

ext_datatype [{Ref|Value}] [As pc_type]

ext_type

The datatype of the parameter expected by the function. To specify the type you can use any of the following:

  • BOOLEAN

  • INTEGER

  • LONG

  • UINTEGER

  • ULONG

  • STRING

  • STRING

  • FLOAT

  • DOUBLE

Ref | Value

Optionally use one of these two reserved words to specify whether the parameter is passed by reference or by value. If Ref is specified, it is passed by pushing a reference (pointer) on the stack. If Value is specified the value is pushed on the stack (for integers, and so on.) If neither is specified, Ref is assumed.

AS pc_type

Specifies PeopleCode data type of the value passed to the function. You can choose between PeopleCode data types String, Number, Date, Boolean, and Any.

Returns ext_return_type

Specifies the data type of any value returned by the function. The Returns clause is omitted if the function is void (returns no value.) To specify the return type you can use any of the following:

  • BOOLEAN

  • INTEGER

  • LONG

  • UINTEGER

  • ULONG

  • FLOAT

  • DOUBLE

The types String and LString are not allowed for the result type of a function.

As pc_return_type

Specifies the PeopleCode data type of the variable or field into which to read the returned value. You can choose between PeopleCode data types String, Number, Date, Boolean, and Any. If the As clause is omitted, PeopleTools selects an appropriate type based on the type of value returned by the external function (for example, all integer and floating point types are converted to Number).

Example

Assume you have defined a PeopleCode function called VerifyZip. The function definition is located in the record definition FUNCLIB_MYUTILS, in the record field ZIP_EDITS, attached to the FieldFormula event. You would declare the function using the following statement:

declare function verifyzip PeopleCode FUNCLIB_MYUTILS.ZIP_EDITS FieldFormula;

Now assume you want to declare a function called PCTest, in PSUSER.DLL. It takes an integer and returns an integer. You would write this declare statement:

declare function pctest library "psuser.dll" (integer value as number) returns integer as number;

See Also

Function.

Click to jump to top of pageClick to jump to parent topicDecrypt

Syntax

Decrypt(KeyString, EncryptedString)

Description

Use the Decrypt function to decrypt a string previously encrypted with the Encrypt function. This function is generally used with merchant passwords. For this function to decrypt a string successfully, you must use the same KeyString value used to encrypt the string.

Parameters

KeyString

Specify the key used for encrypting the string. You can specify a NULL value for this parameter, that is, two quotation marks with no blank space between them ("").

EncryptedString

Specify the string you want decrypted.

Returns

A clear text string.

Example

Encrypt and Decrypt support only strings.

&AUTHPARMS.WRKTOKEN.Value = Decrypt("", RTrim(LTrim(&MERCHANTID_REC.CMPAUTHNTCTNTOKEN.Value)));

See Also

Encrypt, Hash.

Understanding PeopleSoft Security

Click to jump to top of pageClick to jump to parent topicDegrees

Syntax

Degrees(angle)

Description

Use the Degrees function to convert the given angle from radian measurement to degree measurement.

Parameters

angle

The size of an angle in radians.

Returns

The size of the given angle in degrees.

Example

The following example returns the equivalent size in degrees of an angle measuring 1.2 radians:

&DEGREE_SIZE = Degrees(1.2);

See Also

Acos, Asin, Atan, Cos, Cot, Radians, Sin, Tan.

Click to jump to top of pageClick to jump to parent topicDeleteAttachment

Syntax

DeleteAttachment(URLSource, DirAndFileName[, PreserveCase])

where URLSource can have one of the following forms:

URL.URLname

Or a string URL, such as

ftp://user:password@ftp.ps.com/

Note. You cannot specify a different port for an attachment when using an FTP server. You can only use the default port of 21.

Note. The file attachment functionality does not support SFTP or FTPS.

Description

Use the DeleteAttachment function to delete a file on a specified system.

DeleteAttachment does not generate any type of “Are you sure” message. If you want the user to verify the deletion before it's performed, you must write your own checking code in your application.

File Name Considerations

When the file is transferred, the following characters are replaced with an underscore:

Parameters

URLSource

A reference to a URL. This can be either a URL name, in the form URL.URLName, or a string. This is where the file will end up.

DirAndFileName

A directory and filename. This is appended to the URLSource to make up the full URL of the file.

PreserveCase

Specify a Boolean value to indicate whether the case of the directory and file name specified with DirAndFileName are preserved or not; true, preserve the case, false, convert the filename extension to all lower case letters. The default value is false.

Note. The URLSource requires "/" slashes. Because the DirAndFileName parameter is appended to the URL, it also requires only "/" slashes. "\" are not supported in anyway for either the URLSource the DirAndFileName parameter.

Returns

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

Numeric Value

Constant Value

Description

0

%Attachment_Success

File was attached successfully.

1

%Attachment_Failed

File was not successfully attached.

2

%Attachment_Cancelled

File attachment didn't complete because the operation was canceled by the user.

7

%Attachment_DestSystNotFound

Cannot locate destination system for ftp.

8

%Attachment_DestSystFailedLogin

Unable to login to destination system for ftp.

9

%Attachment_FileNotFound

Cannot locate file.

10

%Attachment_DeleteFailed

Cannot delete file.

Example

&retcode = DeleteAttachment(URL.BKFTP, ATTACHSYSFILENAME); If (&retcode = %Attachment_Success) Then MessageBox(0, "File Attachment Status", 0, 0, "DeleteAttachment succeeded"); UnHide(ATTACHADD); Hide(ATTACHVIEW); Hide(ATTACHDELETE); ATTACHUSERFILE = ""; ATTACHSYSFILENAME = ""; End-If; If (&retcode = %Attachment_Failed) Then MessageBox(0, "File Attachment Status", 0, 0, "DeleteAttachment failed"); End-If; If (&retcode = %Attachment_Cancelled) Then MessageBox(0, "File Attachment Status", 0, 0, "DeleteAttachment cancelled"); End-If; If (&retcode = %Attachment_FileTransferFailed) Then MessageBox(0, "File Attachment Status", 0, 0, "DeleteAttachment failed: File Transfer did not succeed"); End-If; /* following error message only in PeopleSoft Pure Internet Architecture */ If (&retcode = %Attachment_NoDiskSpaceAppServ) Then MessageBox(0, "File Attachment Status", 0, 0, "DeleteAttachment failed: No disk space on the app server"); End-If; /* following error message only in PeopleSoft Pure Internet Architecture */ If (&retcode = %Attachment_NoDiskSpaceWebServ) Then MessageBox(0, "File Attachment Status", 0, 0, "DeleteAttachment failed: No disk space on the web server"); End-If; If (&retcode = %Attachment_FileExceedsMaxSize) Then MessageBox(0, "File Attachment Status", 0, 0, "DeleteAttachment failed: File exceeds the max size"); End-If; If (&retcode = %Attachment_DestSystNotFound) Then MessageBox(0, "File Attachment Status", 0, 0, "DeleteAttachment failed: Cannot locate destination system for ftp"); End-If; If (&retcode = %Attachment_DestSysFailedLogin) Then MessageBox(0, "File Attachment Status", 0, 0, "DeleteAttachment failed: Unable to login into destination system for ftp"); End-If;

See Also

AddAttachment, GetAttachment, PutAttachment, ViewAttachment.

Using File Attachments in Applications

Click to jump to top of pageClick to jump to parent topicDeleteEmailAddress

Syntax

DeleteEmailAddress(Type)

Description

Use the DeleteEmailAddress function to delete the email address associated with the specified type for the current user. You can only have one email address of a specific type for a user.

Note. You can only delete the Primary Email Address if it's the only address. If the email address you want to delete is marked as the primary email address, and it is not the only email address, you must mark another email address as primary before you can delete the email address you want to delete. Use the MarkPrimaryEmailAddress function to set the primary email address.

Parameters

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

Returns

None.

See Also

AddEmailAddress, ChangeEmailAddress, MarkPrimaryEmailAddress.

Click to jump to top of pageClick to jump to parent topicDeleteImage

Syntax

DeleteImage(scrollpath, target_row, [recordname.]fieldname)

where scrollpath is:

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

Description

Use the DeleteImage function to remove an image associated with a record field.

Note. To update an image field using this function, be sure that PSIMAGEVER field is also on the same record as the image field being updated.

Parameters

scrollpath

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

target_row

The row number of the target row.

[recordname .]fieldname

The name of the field associated with the image file. The field can be on scroll level one, two, or three of the active page. The recordname prefix is required if the function call is in a record definition other than recordname.

Returns

Returns a Boolean value: True if image was successfully deleted, False otherwise.

Example

&Rslt = DeleteImage(EMPL_PHOTO.EMPLOYEE_PHOTO);

See Also

InsertImage.

Click to jump to top of pageClick to jump to parent topicDeleteRecord

Syntax

DeleteRecord(level_zero_recfield)

Description

Use the DeleteRecord function to remove a high-level row of data and all dependent rows in other tables from the database.

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

DeleteRecord deletes the component’s level-zero row from the database, deletes any dependent rows in other tables from the database, and exits the component.

This function, like DeleteRow, initially marks the record or row as needing to be deleted. At save time the row is actually deleted from the database and cleared from the buffer.

This function works only if the PeopleCode is on a level-zero field. It cannot be used from SavePostChange or WorkFlow PeopleCode.

See Also

Delete, Accessing the Data Buffer.

Parameters

level_zero_recfield

A recordname.fieldname reference identifying any field on the level-zero area of the page.

Returns

Optionally returns a Boolean value indicating whether the deletion was completed successfully.

Example

The following example, which is in SavePreChange PeopleCode on a level-zero field, deletes the high-level row and all dependent rows in other tables if the current page is EMPLOYEE_ID_DELETE.

if %Page = PAGE.EMPLOYEE_ID_DELETE then &success = DeleteRecord(EMPLID); end-if;

See Also

DeleteRow.

Click to jump to top of pageClick to jump to parent topicDeleteRow

Syntax

DeleteRow(scrollpath, target_row)

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 DeleteRow function to delete rows programmatically.

Note. This function remains for backward compatibility only. Use the DeleteRow rowset class method instead.

See DeleteRow.

A call to this function causes the RowDelete event sequence to fire, as if an user had manually deleted a row.

DeleteRow cannot be executed from the same scroll level where the deletion will take place, or from a lower scroll level. Place the PeopleCode in a higher scroll level record.

When DeleteRow is used in a loop, you have to process rows from high to low to achieve the correct results, that is, you must delete from the bottom up rather than from the top down. This is necessary because the rows are renumbered after they are deleted (if you delete row one, row two becomes row one).

See Also

DeleteRow, Accessing the Data Buffer, Specifying Data with References Using Scroll Path Syntax and Dot Notation.

Parameters

scrollpath

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

target_row

The row number of the row to delete.

Returns

Boolean (optional). DeleteRow returns a Boolean value indicating whether the deletion was completed successfully.

Example

In the following example DeleteRow is used in a For loop. The example checks values in each row, then conditionally deletes the row. Note the syntax of the For loop, including the use of the -1 in the Step clause to loop from the highest to lowest values. This ensures that the renumbering of the rows will not affect the loop.

For &L1 = &X1 To 1 Step - 1 &SECTION = FetchValue(AE_STMT_TBL.AE_SECTION, &L1); &STEP = FetchValue(AE_STMT_TBL.AE_STEP, &L1); If None(&SECTION, &STEP) Then DeleteRow(RECORD.AE_STMT_TBL, &L1); End-If; End-For;

See Also

InsertRow, Specifying Data with References Using Scroll Path Syntax and Dot Notation.

Click to jump to top of pageClick to jump to parent topicDeleteSQL

Syntax

DeleteSQL([SQL.]sqlname[, dbtype[, effdt]])

Description

Use the DeleteSQL function to programmatically delete a SQL definition. The SQL definition must have already been created and saved, either using the CreateSQL and StoreSQL functions, or by using Application Designer.

When you create a SQL definition, you must create a base statement before you can create other types of statements, that is, one that has a dbtype as GENERIC and effdt as the null date (or Date(19000101)). If you specify a base (generic) statement to be deleted, all statements as well as the generic statement are deleted.

If you specify a non-generic statement that ends up matching the generic statement, DeleteSQL does not delete anything, and returns False.

You must commit all database changes prior to using this function. This is to avoid locking critical Tools tables and hence freezing all other users. You receive a runtime error message if you try to use this function when there are pending database updates, and your PeopleCode program terminates. You need to commit any database updates prior to using this function. The CommitWork PeopleCode function has been enhanced to allow this.

Parameters

sqlname

Specify the name of a SQL definition. This is either in the form SQL.sqlname or a string value giving the sqlname.

dbtype

Specify the database type associated with the SQL definition. This parameter takes a string value. If dbtype isn’t specified or is null (""), it set by default to the current database type (the value returned from the %DbName system variable.)

Valid values for dbtype are as follows. These values are not case sensitive:

  • APPSRV

  • DB2ODBC

  • DB2UNIX

  • INFORMIX

  • MICROSFT

  • ORACLE

  • SYBASE

Note. Database platforms are subject to change.

effdt

Specify the effective date associated with the SQL definition. If effdt isn’t specified, it is set by default to the current as of date, that is, the value returned from the %AsOfDate system variable.

Returns

A Boolean value: True if the delete was successful, False if the specified SQL statement wasn’t found, and terminates with an error message if there was another problem (that is, date in incorrect format, and so on.)

Example

The following code deletes the ABCD_XY SQL definition for the current DBType and as of date:

&RSLT = DeleteSQL(SQL.ABC_XY); If NOT(&RSLT) Then /* SQL not found − do error processing */ End-if;

The following code deletes the ABCD_XY SQL Definition for the current DBType and November 3, 1998:

&RSLT = DeleteSQL(SQL.ABCD_XY, "",Date(19981103));

See Also

CreateSQL, FetchSQL, GetSQL, StoreSQL, CommitWork.

SQL Class

%DbName

%AsOfDate

Click to jump to top of pageClick to jump to parent topicDeleteSystemPauseTimes

Syntax

DeleteSystemPauseTimes(StartDay, StartTime, EndDay, EndTime)

Description

Use the DeleteSystemPauseTimes function to delete pause times that occur on your system by adding a row to the system pause times table.

This function is used in the PeopleCode for the Message Monitor. Pause times are set up in the Message Monitor.

Parameters

StartDay

Specify a number from 0-6. The values are:

 

Value

Description

0

Sunday

1

Monday

2

Tuesday

3

Wednesday

4

Thursday

5

Friday

6

Saturday

 

StartTime

Specify a time, in seconds, since midnight.

EndDay

Specify a number from 0-6. The values are:

 

Value

Description

0

Sunday

1

Monday

2

Tuesday

3

Wednesday

4

Thursday

5

Friday

6

Saturday

 

EndTime

Specify a time, in seconds, since midnight.

Returns

A Boolean value: True if the system pause time specified was deleted, False otherwise.

Example

Component Boolean &spt_changed; /* deleting a system pause time interval; */ If Not DeleteSystemPauseTimes(PSSPTIMES.STARTINGDAY, PSSPTIMES.STARTINGSECOND, PSSPTIMES.ENDINGDAY, PSSPTIMES.ENDINGSECOND) Then Error MsgGetText(117, 15, ""); Else &spt_changed = True; /* to force a save; */ PSSPTIMES.MSGSPTNAME = " "; DoSave(); End-If;

See Also

AddSystemPauseTimes.

Using the Service Operations Monitor

Click to jump to top of pageClick to jump to parent topicDeQueue

Syntax

DeQueue(physical queue ID, task type, task number, agent ID)

Description

Once a task that has been placed in a queue by the EnQueue function and has been completed by the agent, use the DeQueue function to notify the queue server. The queue server removes the task from the queue and subtracts the cost of that task from the agent's workload.

Note. The queue server does not allow a task to be dequeued if the agent who owns that task is not logged on to that particular queue server. PeopleSoft recommends that you only use the DeQueue function in application pages that the MultiChannel Framework Console launches when agents accept or activate assigned tasks.

Parameters

physical queue ID

The physical queue is the internal representation of the logical queue that the agent signs onto and to which the task currently belongs. This is a string value, such as “sales3” or “marketing2.” You retrieve the current physical queue from the query string in the URL of the page launched by the MultiChannel Framework console, using the GetParameter request class method with the value ps_qid.

task type

Specifies the type of task that an agent completed. It is a string value. The valid values are:

  • email

  • generic

Note. This parameter is valid only for persistent tasks (email and generic). It is not valid for chat or voice tasks.

You can retrieve the value from the query string in the URL of the application page launched by the MultiChannel Framework console. Use the GetParameter request class method with the value ps_tasktype.

task number

Uniquely identifies a particular task. This is the task number returned by the Enqueue function when the system first inserted the task into a queue. This is a string value.

You can retrieve the value from the query string in the URL of the application page launched by the MultiChannel Framework console. Use the GetParameter request class method with the value ps_tasknum.

agent ID

Identifies the agent who processed the task. This is a string value.

You can retrieve the value from the query string in the URL of the application page launched by the MultiChannel Framework console. Use the GetParameter request class method with the value ps_agentid.

Returns

Returns 0 for success. Otherwise, it returns a message number. The message set ID for MultiChannel Framework is 162.

For example, 1302 is returned when an invalid task type or no value is provided.

Example

PSMCFFUNCLIB.MCF_QUEUE.Value = %Request.GetParameter("ps_qid"); PSMCFFUNCLIB.MCF_TASKTYPE.Value = %Request.GetParameter("ps_tasktype"); PSMCFFUNCLIB.MCF_TASKNUM.Value = %Request.GetParameter("ps_tasknum"); PSMCFFUNCLIB.MCF_AGENTID.Value = %Request.GetParameter("ps_agentid"); &nret = DeQueue(PSMCFFUNCLIB.MCF_QUEUE, PSMCFFUNCLIB.MCF_TASKTYPE, PSMCFFUNCLIB.MCF_TASKNUM, PSMCFFUNCLIB.MCF_AGENTID); If &nret = 0 Then MessageBox(0, "", 0, 0, "Successfully dequeued."); End-If

See Also

EnQueue.

Click to jump to top of pageClick to jump to parent topicDetachAttachment

Syntax

DetachAttachment(URLSource, DirAndFileName, UserFile [,PreserveCase])

where URLSource can have one of the following forms:

URL.URLname

Or a string URL, such as

ftp://user:password@ftp.ps.com/

Note. You cannot specify a different port for an attachment when using an FTP server. You can only use the default port of 21.

Note. The file attachment functionality does not support SFTP or FTPS.

Description

Use the DetachAttachment function to enable a user to make a copy of an attached file on their local client system. The file is sent to the browser with appropriate HTTP headers to cause the browser to display a save dialog box to the user.

The detached file may have a different name than the name the user typed in.

Security Considerations

The FileType parameter used with the AddAttachment function is only a suggestion. Specifying it does not enforce specific file types. If you do not want specific file types detached (such as .exe or .bat) you must write PeopleCode to discern the name and file type of the attached file and delete it before detaching it.

Restrictions on Use in PeopleCode Events

DetachAttachment is a "think-time" function, which means that it shouldn’t be used in any of the following PeopleCode events:

See Think-Time Functions.

File Name Considerations

When the file is transferred, the following characters are replaced with an underscore:

File Size Considerations

You may need to increase the heap size of your server if you are trying to detach files that are approximately five MB or larger. This size may differ depending on your servers and configuration. If the heap size is too small, you may receive an out of memory error.

See Increasing the Java Heap Size to Accommodate Posting Large Files.

Parameters

URLSource

A reference to a URL. This can be either a URL name, in the form URL.URLName, or a string.

DirAndFileName

A directory and filename. This is appended to the URLSource to make up the full URL of the file.

PreserveCase

Specify a Boolean value to indicate whether the case of the directory and file name specified with DirAndFileName are preserved or not; true, preserve the case, false, convert the filename extension to all lower case letters. The default value is false.

Note. The URLSource requires "/" slashes. Because the DirAndFileName parameter is appended to the URL, it also requires only "/" slashes. "\" are NOT supported in anyway for either the URLSource the DirAndFileName parameter.

Returns

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

Numeric Value

Constant Value

Description

0

%Attachment_Success

File was attached successfully.

1

%Attachment_Failed

File was not successfully attached.

2

%Attachment_Cancelled

File attachment didn't complete because the operation was canceled by the user.

3

%Attachment_FileTransferFailed

File transfer didn't succeed.

5

%Attachment_NoDiskSpaceWebServ

No disk space on the web server.

7

%Attachment_DestSystNotFound

Cannot locate destination system for ftp.

8

%Attachment_DestSystFailedLogin

Unable to login to destination system for ftp.

9

%Attachment_FileNotFound

Cannot locate file.

10

%Attachment_DeleteFailed

Cannot delete file.

11

%Attachment_NoFileName

Attachment failed because no file name was specified.

Example

&retcode = DetachAttachment(URL.MYFTP, ATTACHSYSFILENAME, ATTACHUSERFILE); If (&retcode = %Attachment_Failed) Then MessageBox(0, "File Attachment Status", 0, 0, "DetachAttachment failed"); End-If; If (&retcode = %Attachment_Cancelled) Then MessageBox(0, "File Attachment Status", 0, 0, "DetachAttachment cancelled"); End-If; If (&retcode = %Attachment_FileTransferFailed) Then MessageBox(0, "File Attachment Status", 0, 0, "DetachAttachment failed: File Transfer did not succeed"); End-If; /* following error message only in PeopleSoft Pure Internet Architecture */ If (&retcode = %Attachment_NoDiskSpaceAppServ) Then MessageBox(0, "File Attachment Status", 0, 0, "DetachAttachment failed: No disk space on the app server"); End-If; /* following error message only in PeopleSoft Pure Internet Architecture */ If (&retcode = %Attachment_NoDiskSpaceWebServ) Then MessageBox(0, "File Attachment Status", 0, 0, "DetachAttachment failed: No disk space on the web server"); End-If; If (&retcode = %Attachment_FileExceedsMaxSize) Then MessageBox(0, "File Attachment Status", 0, 0, "DetachAttachment failed: File exceeds the max size"); End-If; If (&retcode = %Attachment_DestSystNotFound) Then MessageBox(0, "File Attachment Status", 0, 0, "DetachAttachment failed: Cannot locate destination system for ftp"); End-If; If (&retcode = %Attachment_DestSysFailedLogin) Then MessageBox(0, "File Attachment Status", 0, 0, "DetachAttachment failed: Unable to login into destination system for ftp"); End-If;

In the following example, using the file object, a file is written on the application server. Because the absolute path isn't specified, the file is written to PS_SERVDIR/files directory.

The function PutAttachment takes the file from PS_SERVDIR/files directory and puts it on the ftp server specified in URL.GRADEBOOK.

The DetachAttachment function downloads the file into the user's machine.

/* Data buffer */ Component Rowset &Level0, &Students_Hdr, &Student_Grade; Component Row &Level0_Row; /* standalone rowset - populate from LAM_CLASS_ACTV */ Component Rowset &Class_Activity; Component number &Class_Act_No; Local File &Export_File; Local string &Export_Line; DoSaveNow(); &File_Name = %OperatorId | "_" | String(CLASS_SCTN_SCTY.STRM) | "_" | String(CLASS_SCTN_SCTY.CLASS_NBR) | ".txt"; &Export_File = GetFile(&File_Name, "W"); If &Export_File.IsOpen Then &Export_Line = "Last,First,Emplid,"; For &i = 1 To &Class_Activity.ActiveRowCount &Export_Line = &Export_Line | &Class_Activity(&i).LAM_CLASS_ACTV.DESCRSHORT.Value | ","; End-For; &Export_File.WriteLine(&Export_Line); For &i = 1 To &Students_Hdr.ActiveRowCount &Export_Line = &Students_Hdr(&i).GetRecord(Record.PERSONAL_DTA_VW).GetField(Field.NAME).Value | ","; &Export_Line = &Export_Line | &Students_Hdr(&i).STDNT_GRADE_HDR.EMPLID.Value | ","; &Student_Grade = &Level0_Row.GetRowset(Scroll.STDNT_GRADE_HDR)(&i).GetRowset(Scroll.STDNT_GRADE_DTL); For &j = 1 To &Student_Grade.ActiveRowCount &Export_Line = &Export_Line | String(&Student_Grade(&j).STDNT_GRADE_DTL.STUDENT_GRADE.Value) | ","; End-For; &Export_File.WriteLine(&Export_Line); End-For; &Export_File.Close(); End-If; &Put_File_Name = "files/" | &File_Name; &ret = PutAttachment(URL.GRADEBOOK, &File_Name, &Put_File_Name, "PS_SERVDIR"); &ret = DetachAttachment(GetURL(URL.GRADEBOOK), &File_Name, &File_Name);

Click to jump to top of pageClick to jump to parent topicDisableMenuItem

Syntax

DisableMenuItem(BARNAME.menubar_name, ITEMNAME.menuitem_name)

Description

Use the DisableMenuItem function to disable (make unavailable) the specified menu item. To apply this function to a pop-up menu, use the PrePopup Event of the field with which the pop-up menu is associated.

If you’re using this function with a pop-up menu associated with a page (not a field), the earliest event you can use is the PrePopup event for the first "real" field on the page (that is, the first field listed in the Order view of the page in PeopleSoft Application Designer.)

Restrictions on Use With a Component Interface

This function is ignored (has no effect) when used by a PeopleCode program that’s been called by a Component Interface.

Parameters

menubar_name

Name of the menu bar that owns the menu item, or, in the case of pop-up menus, the name of the pop-up menu that owns the menu item.

menuitem_name

Name of the menu item.

Returns

None.

Example

DisableMenuItem(BARNAME.MYPOPUP1, ITEMNAME.DO_JOB_TRANSFER);

See Also

EnableMenuItem, HideMenuItem.

PrePopup Event

Click to jump to top of pageClick to jump to parent topicDiscardRow

Syntax

DiscardRow()

Description

Use the DiscardRow function to prevent a row from being added to a page scroll during Row Select processing. This function is valid only in RowSelect PeopleCode. When DiscardRow is called during RowSelect processing, the current row is skipped (not added to the scroll). Processing then continues on the next row, unless the StopFetching function has also been called, in which case no more rows are added to the page.

If you try to discard a row and it's the only row in the scroll, the row is not discarded. You will still have one blank row in your scroll.

DiscardRow has the same functionality as the Warning function in the RowSelect event. The anomalous behavior of Warning is supported for compatibility with previous releases of PeopleTools.

Note. RowSelect processing is used infrequently, because it is more efficient to filter out rows of data using a search view or an effective-dated record before the rows are selected into the component buffer from the database server.

RowSelect Processing Logic

Parameters

None.

Returns

None.

See Also

StopFetching, Warning.

Row Select Processing

Click to jump to top of pageClick to jump to parent topicDoCancel

Syntax

DoCancel( )

Description

Use the DoCancel function to cancel the current page.

DoCancel terminates any PeopleCode programs executing prior to a save action. It does not stop processing of PeopleCode in SaveEdit, SavePreChange, and SavePostChange events.

Returns

None.

See Also

DoSave, DoSaveNow, DoModal, EndModal, WinEscape.

Click to jump to top of pageClick to jump to parent topicDoModal

Syntax

DoModal(PAGE.pagename, title, xpos, ypos, [level, scrollpath, target_row])

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 DoModal function to display a secondary page. Secondary pages are modal, meaning that the user must dismiss the secondary page before continuing work in the page from which the secondary page was called.

If you call DoModal without specifying a level number or any record parameters, the function uses the current context as the parent.

You can alternately specify a secondary page in a command push button definition without using PeopleCode. This may be preferable for performance reasons, especially with PeopleSoft Pure Internet Architecture.

DoModal can display on a single page. To display an entire component modally, use DoModalComponent.

Any variable declared as a Component variable will still be defined after using a DoModal function.

See Using Secondary Pages.

Restrictions on Use in PeopleCode Events

Control does not return to the line after DoModal until after the user has dismissed the secondary page. This interruption of processing makes DoModal a “think-time” function, which means that it shouldn’t be used in any of the following PeopleCode events:

In addition, you can't use this function in the SearchInit event.

See Think-Time Functions.

Restrictions on Use With a Component Interface

This function is ignored (has no effect) when used by a PeopleCode program that’s been called by a Component Interface.

Considerations Using Exceptions and the DoModal Function

Using the DoModal function inside a try block not catch PeopleCode exceptions thrown in the new component. Starting a new component starts a brand new PeopleCode evaluation context. Catches are only caught for exceptions thrown within the current component.

In the following code example, the catch statement only catches exceptions thrown in the code prior to the DoModal, but not any exceptions that are thrown within the new component.

/* Set up transaction */ If %CompIntfcName = "" Then try &oTrans = &g_ERMS_TransactionCollection.GetTransactionByName(RB_EM_WRK.DESCR); &sSearchPage = &oTrans.SearchPage; &sSearchRecord = &oTrans.SearchRecord; &sSearchTitle = &oTrans.GetSearchPageTitle(); If Not All(&sSearchPage, &sSearchRecord, &sSearchTitle) Then Error (MsgGetText(17834, 8081, "Message Not Found")); End-If; &c_ERMS_SearchTransaction = &oTrans; /* Attempt to transfer to hidden search page with configurable filter */ &nModalReturn = DoModal(@("Page." | &sSearchPage), &sSearchTitle, - 1, - 1); catch Exception &e Error (MsgGetText(17834, 8082, "Message Not Found")); end-try;

Parameters

pagename

The name of the secondary page.

title

The text that displays in the caption of the secondary page.

xpos

The pixel coordinates of the top left corner of the secondary page, offset from the top left corner of the parent page (the default of -1, -1 means centered).

ypos

The pixel coordinates of the top right corner of the secondary page, offset from the top right corner of the parent page (the default of -1, -1 means centered).

level

Specifies the level of the scroll level on the parent page that contains the row corresponding to level 0 on the secondary page.

scrollpath

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

target_row

The row number of the row in the parent page corresponding to the level 0 row in the secondary page.

Returns

Returns a number that indicates how the secondary page was terminated. A secondary page can be terminated by the user clicking a built-in OK or Cancel button, or by a call to the EndModal function in a PeopleCode program. In either case, the return value of DoModal is one of the following:

Example

DoModal(PAGE.EDUCATION_DTL, MsgGetText(1000, 167, "Education Details - %1", EDUCATN.DEGREE), - 1, - 1, 1, RECORD.EDUCATN, CurrentRowNumber());

See Also

EndModal, IsModal, DoModalComponent.

Specifying Data with References Using Scroll Path Syntax and Dot Notation

Click to jump to top of pageClick to jump to parent topicDoModalComponent

Syntax

DoModalComponent(MENUNAME.menuname, BARNAME.barname, ITEMNAME.menuitem_name, PAGE.component_item_name, action, RECORD.shared_record_name [, keylist])

where keylist is a list of field references in the form:

[recordname.]field1 [, [recordname.]field2]. . .

Or

&RecordObject1 [, &RecordObject2]. . .

Description

Use the DoModalComponent function to launch a modal component. The modal component launches from within an originating component. After the modal component displays, the user can’t proceed with changes to the originating component until either accepting or canceling the modal component.

Modal components can be displayed in any of the following action modes: Add, Update/Display, Update/Display All, Correction. A modal component can be launched from any component, including another modal component. You can use DoModalComponent from a secondary page.

The originating component and the modal component share data, including search keys, using a Shared Work Record or the values in the fieldlist parameter. If valid search keys are provided in the shared work record and populated with valid values before launching the modal component, the search is conducted using the provided search key values. If the fieldlist parameter isn't used and no search keys are provided, or if search key fields contain invalid values, the user accesses the modal component using a search dialog box.

Note. The user may see a different title for a search page if they enter the search page using this function versus from the regular navigation.

In the component_item_name parameter, make sure to pass the component item name for the page, not the page name. The component item name is specified in the Component Definition, in the Item Name column on the row corresponding to the specific page, as shown here:

Component Item Name parameter

Shared Work Records

The originating component and the modal component share fields in a Derived/Work record called a shared work record. Shared fields from this record must be placed at level zero of both the originating component and the modal component.

You can use the shared fields to:

To do this, you have to write PeopleCode that:

Restrictions on Use With a Component Interface

This function is ignored (has no effect) when used by a PeopleCode program that’s been called by a Component Interface.

Restrictions on Use With SearchInit Event

You can't use this function in a SearchInit PeopleCode program.

Considerations Using Exceptions and the DoModalComponent Function

Using the DoModalComponent function inside a try block not catch PeopleCode exceptions thrown in the new component. Starting a new component starts a brand new PeopleCode evaluation context. Catches are only caught for exceptions thrown within the current component.

In the following code example, the catch statement only catches exceptions thrown in the code prior to using a DoModal function, but not any exceptions that are thrown within the new component.

/* Set up transaction */ If %CompIntfcName = "" Then try &oTrans = &g_ERMS_TransactionCollection.GetTransactionByName(RB_EM_WRK.DESCR); &sSearchPage = &oTrans.SearchPage; &sSearchRecord = &oTrans.SearchRecord; &sSearchTitle = &oTrans.GetSearchPageTitle(); If Not All(&sSearchPage, &sSearchRecord, &sSearchTitle) Then Error (MsgGetText(17834, 8081, "Message Not Found")); End-If; &c_ERMS_SearchTransaction = &oTrans; /* Attempt to transfer to hidden search page with configurable filter */ &nModalReturn = DoModal(@("Page." | &sSearchPage), &sSearchTitle, - 1, - 1); catch Exception &e Error (MsgGetText(17834, 8082, "Message Not Found")); end-try;

Parameters

menuname

Name of the menu through which the modal component is accessed.

barname

Name of the menu bar through which the modal component is accessed.

menuitem_name

Name of the menu item through which the modal component is accessed.

component_item_name

The component item name of the page to be displayed on top of the modal component when it displays. The component item name is specified in the component definition.

action

String representing the action mode in which to start up the component. You can use either a character value (passed in as a string) or a constant:

 

Numeric Value

Constant Value

Description

A

%Action_Add

Add

U

%Action_UpdateDisplay

Update/Display

L

%Action_UpdateDisplayAll

Update/Display All

C

%Action_Correction

Correction

E

%Action_DataEntry

Data Entry

P

%Action_Prompt

Prompt

 

If only one action mode is allowed for the component, that action mode is used. If more than one action mode is allowed, the user can select which mode to come up in.

shared_record_name

The record name of the shared work record (preceded by the reserved word Record). This record must include:

  • Fields that are search keys in the modal component search record; if search key fields are not provided, or if they are invalid, the user accesses the modal component using the search dialog box.

  • Other fields to pass to the modal component.

  • Fields to get back from the modal component after it has finished processing.

keylist

An optional list of field specifications used to select a unique row at level zero in the page you are transferring to, by matching keys in the page you are transferring from. It can also be an already instantiated record object. If a record object is specified, any field of that record object that is also a field of the search record for the destination component is added to keylist. The keys in fieldlist must uniquely identify a row in the "to" page search record. If a unique row is not identified, the search dialog box appears.

If the keylist parameter is not supplied then the destination components' search key must be found as part of the source component's level 0 record buffer.

Returns

Returns a Boolean that indicates how the secondary page was terminated. A secondary page can be terminated by the user clicking a built-in OK or Cancel button, or by a call to the EndModalComponent function in a PeopleCode program. In either case, the return value of DoModalComponent is one of the following:

Example

The following example shows how to structure a DoModalComponent function call:

DoModalComponent(MENUNAME.MAINTAIN_ITEMS_FOR_INVENTORY, BARNAME.USE_A, ITEMNAME.ITEM_DEFINITION, COMPONENT.ESTABLISH_AN_ITEM, "C", RECORD.NEW7_WRK);

Supporting PeopleCode is required if you must assign values to fields in the shared work record or access those values, either from the originating component, or from the modal component.

See Also

IsModalComponent, Transfer, TransferPage, EndModalComponent.

Implementing Modal Transfers

Click to jump to top of pageClick to jump to parent topicDoModalPanelGroup

Syntax

DoModalPanelGroup(MENUNAME.menuname, BARNAME.barname, ITEMNAME.menuitem_name, PANEL.panel_group_item_name, action, RECORD.shared_record_name)

Description

Use the DoModalPanelGroup function to launch a modal component.

Note. The DoModalPanelGroup function is supported for compatibility with previous releases of PeopleTools. Future applications should use DoModalComponent instead.

See Also

DoModalComponent.

Click to jump to top of pageClick to jump to parent topicDoSave

Syntax

DoSave()

Description

Use the DoSave function to save the current page. DoSave defers processing to the end of the current PeopleCode program event, as distinct from DoSaveNow, which causes save processing (including SaveEdit, SavePreChange, SavePostChange, and Workflow PeopleCode) to be executed immediately.

DoSave can be used only in FieldEdit, FieldChange, or MenuItemSelected PeopleCode.

Parameters

None.

Returns

None.

Example

The following example sets up a key list with AddKeyListItem, saves the current page, and then transfers the user to a page named PAGE_2.

ClearKeyListItem( ); AddKeyListItem(OPRID, OPRID); AddKeyListItem(REQUEST_ID, REQUEST_ID); SetNextPage("PAGE_2"); DoSave( ); TransferPage( );

See Also

DoCancel, DoSaveNow, TransferPage, AddKeyListItem.

Click to jump to top of pageClick to jump to parent topicDoSaveNow

Syntax

DoSaveNow()

Description

The DoSaveNow function is designed primarily for use with remote calls. It enables a PeopleCode program to save page data to the database before running a remote process (most frequently a COBOL process) that will access the database directly. It is generally necessary to call DoSaveNow before calling the RemoteCall function.

DoSaveNow causes the current page to be saved immediately. Save processing (including SaveEdit, SavePreChange, SavePostChange, and Workflow PeopleCode) is executed before continuing execution of the program where DoSaveNow is called. DoSaveNow differs from the DoSave function in that DoSave defers saving the component until after any running PeopleCode is completed.

DoSaveNow can only be called from a FieldEdit or FieldChange event.

If you call DoSaveNow and there are no changes to save, save processing is skipped entirely. You can call SetComponentChanged right before you call DoSaveNow. The SetComponentChanged function makes the Component Processor think there are changes and so will force full save processing.

See RemoteCall, DoSave.

Errors in DoSaveNow Save Processing

DoSaveNow initiates save processing. It handles errors that occur during save processing as follows:

Restrictions on Use of DoSaveNow

The following restrictions apply:

Note. You should be aware that DoSaveNow may result in unpredictable behavior if PeopleCode in save events deletes rows or inserts rows into scrolls. PeopleCode that runs after DoSaveNow must be designed around the possibility that rows were deleted or inserted (which causes row number assignments to change). Modifying data on a deleted row may cause it to become “undeleted.”

Parameters

None.

Returns

None.

Example

The following example calls DoSaveNow to save the component prior to running a remote process in the remote_depletion declared function:

Declare Function remote_depletion PeopleCode FUNCLIB_ININTFC.RUN_DEPLETION FieldFormula; /* Express Issue Page - run Depletion job through RemoteCall() */ If %Component = COMPONENT.EXPRESS_ISSUE_INV Then DoSaveNow(); &BUSINESS_UNIT = FetchValue(SHIP_HDR_INV.BUSINESS_UNIT, 1); &SHIP_OPTION = "S"; &SHIP_ID = FetchValue(SHIP_HDR_INV.SHIP_ID, 1); remote_depletion(&BUSINESS_UNIT, &SHIP_OPTION, &SHIP_ID, &PROGRAM_STATUS); End-If

Click to jump to top of pageClick to jump to parent topicEnableMenuItem

Syntax

EnableMenuItem(BARNAME.menubar_name, ITEMNAME.menuitem_name)

Description

Use the EnableMenuItem function to enable (make available for selection) the specified menu item. To apply this function to a pop-up menu, use the PrePopup Event of the field with which the pop-up menu is associated.

If you’re using this function with a pop-up menu associated with a page (not a field), the earliest event you can use is the PrePopup event for the first "real" field on the page (that is, the first field listed in the Order view of the page in PeopleSoft Application Designer.)

Restrictions on Use With a Component Interface

This function is ignored (has no effect) when used by a PeopleCode program that’s been called by a Component Interface.

Parameters

menubar_name

Name of the menu bar that owns the menu item, or, in the case of pop-up menus, the name of the pop-up menu that owns the menu item.

menuitem_name

Name of the menu item.

Returns

None.

Example

EnableMenuItem(BARNAME.MYPOPUP1, ITEMNAME.DO_JOB_TRANSFER);

See Also

DisableMenuItem, HideMenuItem.

PrePopup Event

Click to jump to top of pageClick to jump to parent topicEncodeURL

Syntax

EncodeURL(URLString)

Description

Use the EncodeURL function to apply URL encoding rules, including escape characters, to the string specified by URLString. The method used to encode the URLString is the standard defined by W3C. This function returns a string that contains the encoded URL. All characters outside the Unicode Basic Latin block (U+0020 — U+007F) are encoded, with the exception of the characters in the table below which are not encoded as they may represent valid components of URL or protocol syntax. If you need to encode such characters, use the EncodeURLForQueryString function.

The following table lists the punctuation characters in the Unicode Basic Latin block that are not encoded by the URLEncode function.

Punctuation Character

Description

Glyph

Unicode Character Name

!

Exclamation mark

#

Number sign

$

Dollar sign

&

Ampersand

(

Left parenthesis

)

Right parenthesis

*

Asterisk

+

Plus sign

,

Coma

-

Hyphen, minus

.

Full stop, period

/

Solidus, slash

:

Colon

;

Semi-colon

=

Equals sign

?

Question mark

_

Underscore

Parameters

URLString

Specify the string you want encoded. This parameter takes a string value.

Returns

An encoded string.

Example

The example below returns the following encoded URL:

http://corp.office.com/human%20resources/benefits/401kchange_home.htm?FirstName=Gunter&LastName=D%c3%9crst &MYSTRING = EncodeURL("http://corp.office.com/hr/benefits/401k/401k_home.htm");

See Also

EncodeURLForQueryString, Unencode.

Internet Script Classes (iScript)

Click to jump to top of pageClick to jump to parent topicEncodeURLForQueryString

Syntax

EncodeURLForQueryString(URLString)

Description

Use the EncodeURLForQueryString function to encode URLString for use in a query string parameter in an URL. All characters outside the Unicode Basic Latin block (U+0020 — U+007F) are encoded, with the exception of the characters in the table below which are not encoded as they are typically valid in a query string.

If the link is constructed in a page, and the value is a link field, you should not call EncodeURL to encode the entire URL, as the PeopleSoft Pure Internet Architecture does this for you. You still need to unencode the parameter value when you retrieve it, however.

Always encode each field value being added directly to query strings using EncodeURLForQueryString.

The following table lists punctuation characters in the Unicode Basic Latin block that are not encoded by the URLEncodeForQueryString function.

Punctuation Character

Description

(

Left parenthesis

)

Right parenthesis

*

Asterisk

-

Hyphen, minus

.

Full stop, period

_

Underscore, low line

Parameters

URLString

Specify the string you want encoded. This parameter takes a string value.

Returns

An encoded URL string.

Example

In an Internet Script, to construct an anchor with a URL in a query string parameter, do the following:

&url = "http://host/psp/ps/EMPLOYEE/HRMS/s/EMPL_INFO.FieldFormula.IScript_EMPL_INFO?emplid=1111&mkt=usa" &href = %Request.RequestURI | "?" | %Request.QueryString | "&myurl=" | EncodeURLForQueryString(&url); %Response.WriteLine("<a href= " | EncodeURL(&href) | ">My Link</a>");

The following uses a generic method to find, then encode, the URL, for the external link:

&StartPos = Find("?", &URL, 1); &CPColl = &Portal.ContentProviders; &strHREF = EncodeURLForQueryString(Substring(&URL, &StartPos + 1, Len(&URL) -&StartPos)); &LINK = &Portal.GetQualifiedURL("PortalServlet", "PortalOriginalURL=" | &CPColl.ItembyName(&CP_NAME).URI | "?" | &strHREF);

See Also

EncodeURL, Unencode, EscapeHTML, EscapeJavascriptString, EscapeWML.

Internet Script Classes (iScript)

Click to jump to top of pageClick to jump to parent topicEncrypt

Syntax

Encrypt(KeyString, ClearTextString)

Description

Use the Encrypt function to encrypt a string. This function is generally used with merchant passwords.

The value you use for KeyString must be the same for Decrypt and Encrypt.

Size Considerations with Encrypt

The Encrypt function uses 56 bit DES. The size of the output string is grown to the nearest multiple of 8 bytes, encrypted (which doesn't modify the size), then encoded, which grows the resulting size to the next multiple of 3, then the system multiplies the size by 4/3.

For example, a 20 character field is 40 bytes long (unicode), which is an even multiple of 8. After it is encrypted, it is rounded up to 42 bytes (the next multiple of 3), then multiplied by 4/3 to get 56 bytes.

Parameters

KeyString

Specify the key used for encrypting the string. You can specify a NULL value for this parameter, that is, two quotation marks with no blank space between them ("").

ClearTextString

Specify the string you want encrypted.

Returns

An encrypted string.

Example

The following encrypts a field if it contains a value. It also removes any blanks either preceding or trailing the value.

If All(PSCNFMRCHTOKEN.WRKTOKEN) Then CMPAUTHTOKEN = Encrypt("", RTrim(LTrim(PSCNFMRCHTOKEN.WRKTOKEN))); End-If;

See Also

Decrypt, Hash.

Understanding PeopleSoft Security

Click to jump to top of pageClick to jump to parent topicEncryptNodePswd

Syntax

EncryptNodePswd(Password)

Description

Use the EncryptNodePswd function to encrypt an Integration Broker node password.

Note. This function is generally used with Integration Broker node password encryption. This function should not be used casually, as once you encrypt your node password, there is no decrypt PeopleCode method.

Parameters

Password

Specify the Integration Broker node password that you want encrypted, as a string.

Returns

An encrypted password as a string.

Example

In the following example, the password is stored in the database in an encrypted form instead of as plain text:

PSMSGNODEDEFN.IBPASSWORD = EncryptNodePswd(RTrim(LTrim(PSNODE_WRK.WRKPASSWORD)));

See Also

Adding and Configuring Nodes.

Click to jump to top of pageClick to jump to parent topicEndMessage

Syntax

EndMessage(message, messagebox_title)

Description

Note. The EndMessage function is obsolete and is supported only for backward compatibility. The MessageBox function, which can now be used to display informational messages in any PeopleCode event, should be used instead.

Use the EndMessage function to display a message at the end of a transaction, at the time of the database COMMIT. This function can be used only in SavePostChange PeopleCode.

When an EndMessage function executes, PeopleTools:

Because it terminates the SavePostChange program, EndMessage is always be the last statement executed in the program on the specific field and row where the EndMessage is called. For this reason, you must write the SavePostChange program so that all necessary processing takes place before the EndMessage statement. PeopleCode programs on other fields and rows execute as usual.

Parameters

message

A string that must be enclosed in quotes containing the message text you want displayed.

messagebox_title

A string that must be enclosed in quotes containing the title of the message. It appears in the message box title bar.

Returns

None.

Example

The following example is from SavePostChange event PeopleCode. It checks to see whether a condition is true, and if so, it displays a message and terminates the SavePostChange program. If the condition is false, then processing continues in the Else clause:

If BUSINESS_UNIT = BUS_UNIT_WRK.DEFAULT_SETID Then EndMessage(MsgGet(20000, 12, "Message not found in Message Catalog")," "); Else /* any other SavePostChange processing in Else clause */

See Also

MessageBox, WinMessage.

Click to jump to top of pageClick to jump to parent topicEndModal

Syntax

EndModal(returnvalue)

Description

Use the EndModal function to close a currently open secondary page. It is required only for secondary pages that do not have OK and Cancel buttons. If the secondary page has OK and Cancel buttons, then the function for exiting the page is built in and no PeopleCode is required.

Restrictions on Use With a Component Interface

This function is ignored (has no effect) when used by a PeopleCode program that’s been called by a Component Interface.

Parameters

returnvalue

A Number value that determines whether the secondary page data is copied back to the parent page. A positive value runs SaveEdit PeopleCode and copies the data (this is the same as clicking the OK button). A value of zero skips SaveEdit and discards buffer changes made in the secondary page (this is the same as clicking the Cancel button). This value becomes the return value of the DoModal function that started the secondary page, and it can be tested after the secondary page is closed.

Returns

None.

Example

The following statement acts as an OK button:

EndModal(1);

The following statement acts as a Cancel button:

EndModal(0);

See Also

DoModal, IsModal.

Click to jump to top of pageClick to jump to parent topicEndModalComponent

Syntax

EndModalComponent(ReturnValue)

Description

Use the EndModalComponent function to close a currently open secondary component. You could use this for creating your own links to exit a modal component.

Restrictions on Use With a Component Interface

This function can’t be used by a PeopleCode program that’s been called by a Component Interface, and is ignored.

Parameters

ReturnValue

A Number value that determines whether the modal component data is saved and copied back to the parent page. A positive value saves the data in the component to the database, including all save processing and PeopleCode (this is the same as pressing the OK button). It also copies the data in the shared work record, if any, back to the primary component. A value of zero skips save processing discards buffer changes made in the modal component (this is the same as pressing the Cancel button).

Returns

A Boolean value: True if a non-zero value was used, False if zero was used.

Example

EndModalComponent(0); /* cancels the component without saving */ EndModalComponent(1); /* saves and closes the component */

See Also

DoModalComponent, EndModal, IsModal.

Click to jump to top of pageClick to jump to parent topicEnQueue

Syntax

EnQueue(logical queue, task type, Relative URL, Language_Code [,subject][, agent ID][, overflow timeout][, escalation timeout][, cost][, priority][, skill level])

Description

Use the EnQueue function to assign a task to one of the active, physical queues belonging to the specified logical queue. The physical queue to which the system assigns the task is chosen randomly to balance load across the queues.

Note. PeopleSoft recommends that you always follow the EnQueue function with the NotifyQ function.

See NotifyQ.

Parameters

logical queue ID

Specifies the logical queue in which the task should be queued. It is a string value.

The logical queue ID is a case-sensitive value. The case used in the EnQueue function must exactly match the case used when creating the logical queue ID with the MultiChannel Framework administration pages.

task type

Specifies the type of task to be inserted. It is a string value. The valid values are:

  • email

  • generic

Note. This parameter does not apply to voice or chat. Chat tasks are enqueued using the InitChat function. Voice queueing is managed by PeopleSoft CTI.

Relative URL

The system uses this relative URL to generate the URL of the appropriate application page for the MultiChannel Framework console to launch when an agent accepts this task. The application page should contain the logic to enable the agent to resolve the task and either forward the task using the Forward function or dequeue the task using the DeQueue function.

Language_Code

This is the language code associated with the task to be enqueued. It is a string value that must exist in the PeopleSoft language table.

The queue server only assigns this task to an agent whose list of languages contains this value. For example if an email to be enqueued is written in English, the language code would be “ENG”, and this email would only be assigned to agents whose language list contains English.

subject

This is an optional parameter. It is a string value describing the purpose of the request. This value appears on the agent's console when the system assigns the task.

agent ID

Specifies the assigned agent. This is an optional, string parameter.

If specified, the system holds the task until the specified agent is available to take this task. If this parameter is left blank, the queue server assigns it to the first available agent.

Note. For better performance, PeopleSoft recommends not specifying the target agent as this has a processing overhead for the queue servers and does not allow the system to balance workload across all available agents.

overflow timeout

This is an optional parameter. It is an integer value expressing the overflow timeout in minutes.

The overflow timeout is the time period within which a queue server has to find an agent who accepts the task (clicks on the flashing icon on the MultiChannel console). If the task is not accepted within this time, the task is removed from the queue and placed in the MultiChannel overflow table.

If you do not specify a value, the system uses the default value specified for that task type in the Task Configuration page.

escalation timeout

This is an optional parameter. It is an integer value expressing the escalation timeout in minutes.

The escalation timeout is the time period within which a task must be completed by the agent and closed with DeQueue. If the task is not closed within this time, the task is removed from the queue and from the agent's accepted task list, which means the task becomes unassigned. Then the task is placed in the MultiChannel Framework escalation table.

If no value is specified, the system uses the default specified for that task type in the Task Configuration pages.

cost

This is an optional parameter. It is an integer value measuring the workload each task places on an agent. The cost of a task is an estimate of the tasks's expected complexity and of the time required to resolve the task. The minimum value is 0, and there is no maximum value.

The cost of a task is added to an agent's workload after accepting a task on the MultiChannel Framework console. A task can't be assigned to an agent if the difference between the current workload and the maximum workload defined for that agent on the Agent configuration page is less than the cost of this task.

If you do not specify a value, the system uses the default value specified for that task in the Task Configuration pages.

Note. If the required skill level or cost submitted exceeds the highest skill level or maximum workload of any of the agents on that queue, the task cannot be assigned.

priority

This is an optional parameter. It is an integer value expressing the priority level of the request. The minimum value is 0 and there is no maximum value.

A higher value means a higher priority. Tasks are ordered on a physical queue based on their assigned priority. That is, the system assigns a task of a higher priority before it assigns a task of a lower priority.

If no value is specified, the system uses the default value specified for that task type in the Task Configuration page.

When tasks have the same priority, the system orders the tasks according to the time they were created. For example, suppose the following tasks exist: Priority 2 created at 11:15 AM and Priority 2 created at 11:16 AM. In this case, the system assigns the task created at 11:15 AM before the task created at 11:16 AM.

skill level

This is an optional parameter. It is an integer value expressing the minimum skill level required of the agent to whom the system routes the request. You set an agent's skill level in the Agent configuration page.

The queue server assigns this task type to an available agent on that queue whose lowest skill level is greater than or equal to the skill level required by the task.

If no value is specified, the system uses the default value specified for that task type in the Task Configuration page.

Note. If the required skill level or cost submitted exceeds the highest skill level or maximum workload of any of the agents on that queue, the task cannot be assigned.

Returns

If the insert was successful, the function returns a task number in the form of a string.

If unsuccessful, it returns a message number. The message set ID for MultiChannel Framework is 162.

For example, 1302 is returned when an invalid task type or no value is provided.

Example

&PortalValue = Portal.EMPLOYEE; &NodeValue = Node.QE_LOCAL; /*If running in Application Engine, this code assumes CONTENT URI has been set in node defn admin page*/ &MyCompURL = GenerateComponentContentRelURL(&PortalValue, &NodeValue, MenuName.PT_MCF, "GBL", Component.MCFEM_DEMOERMS_CMP, Page.MCFEM_ERMSMN, ""); &MyCompURL = &MyCompURL | "&ps_emailid=" | &emailid; /*Query string dependent on component. Our demo comonent just needs email id*/ rem The URL to be passed will look something like; rem "/psc/ps/EMPLOYEE/QE_LOCAL/c/PT_MCF.MCF_DEMOERMS_CMP.GBL?Page=MCFEM_ERMSMN"; &strtasknum = EnQueue(&queueID, "email", &MyCompURL, &langcode, &subject, "QEDMO", 15, 60, &cost, &priority, &minskill);

See Also

DeQueue.

Click to jump to top of pageClick to jump to parent topicError

Syntax

Error str

Description

Use the Error function in FieldEdit or SaveEdit PeopleCode to stop processing and display an error message. It is distinct from Warning, which displays a warning message, but does not stop processing. Error is also used in RowDelete and RowSelect PeopleCode events.

Warning! The behavior of the Error function in the RowSelect event is very different from its normal behavior.

See the Error in RowSelect section for more details.

The text of the error message (the str parameter), should always be stored in the Message Catalog and retrieved using the MsgGet or MsgGetText functions. This makes it much easier for the text to be translated, and it also enables you to include more detailed Explain text about the error.

When Error executes in a PeopleCode program, the program terminates immediately and no statements after the Error are executed. In other respects behavior of Error differs, depending on which PeopleCode event the function occurs in.

Errors in FieldEdit and SaveEdit

The primary use of Error is in FieldEdit and SaveEdit PeopleCode:

Errors in RowDelete

When the user attempts to delete a row of data, the system first prompts for confirmation. If the user confirms, the RowDelete event fires. An Error in the RowDelete event displays a message and prevents the row from being deleted.

Error in RowSelect

The behavior of Error in RowSelect is totally anomalous, and is supported only for backward compatibility. It is used to filter rows that are being added to a page scroll after the rows have been selected and brought into the component buffer. No message is displayed. Error causes the Component Processor to add the current row (the one where the PeopleCode is executing) to the page scroll, then stops adding any additional rows to the page scroll.

The behavior of Error in the RowSelect event enables you to filter out rows that are above or below some limiting value. In practice this technique is rarely used, because it is more efficient to filter out rows of data before they are brought into the component buffer. This can be accomplished with search views or effective date processing.

Errors in Other Events

Do not use the Error function in any of the remaining events, which include:

Parameters

Str

A string containing the text of the error message. This string should always be stored in the Message Catalog and retrieved using the MsgGet or MsgGetText function. This makes translation much easier and also enables you to provide detailed Explain text about the error.

Returns

None.

Example

The following example, from SaveEdit PeopleCode, displays an error message, stops all save processing, and places the cursor in the QTY_ADJUSTED field. Note that SetCursorPos must be called before Error.

If PAGES2_INV_WRK.PHYS_CYC_INV_FLG = "Y" Then SetCursorPos(%Page, PHYSICAL_INV.INV_LOT_ID, CurrentRowNumber(1), QTY_ADJUSTED, CurrentRowNumber()); Error MsgGet(11100, 180, "Message not found."); End-If;

See Also

MsgGet, MsgGetText, SetCursorPos, Warning, WinMessage.

Click to jump to top of pageClick to jump to parent topicEscapeHTML

Syntax

EscapeHTML(TextString)

Description

Use the EscapeHTML function to replace all characters in TextString that would otherwise be interpreted as markup sequences.

The characters that are replaced are ones that would cause the browser to interpret them as HTML tags or other markup if they aren't encoded, and therefore pre-formatted HTML should not be passed to this function unless the output desired is a rendering of the HTML code itself as opposed to it's interpretation. This function is intended to make the text "browser safe".

This function is for use with strings that display in an HTML area.

Either HTML character entities (eg. &lt) or Numeric Character Representations (e.g. &#039) are output by the EscapeHTML function, depending on the character passed. The table below shows the escaping that is performed by EscapeHTML.

In addition to escaping characters that could be misinterpreted as HTML tags or other elements, EscapeHTML escapes the percentage sign (%) as this could interfere with meta HTML processing. As all PeopleTools HTML is generated in Unicode, it is not necessary to escape other Unicode characters — their value may be passed directly to the browser instead of a character entity or in Numeric Character Representation.

The following table lists the Unicode characters that are escaped by the EscapeHTML function.

For example, the less-than symbol (<) is replaced with &lt., a single quotation mark (') is replaced with &#039., and so on.

Unicode Character Name

Glyph

Escape Sequence

Quotation mark

&quot;

Ampersand

&

&amp;

Less than sign

<

&lt;

Apostrophe, single quote

'

&#039;

Percentage sign

%

&#037;

New line

Not applicable

<BR>

Parameters

TextString

Specify a string of HTML that contains characters that must be replaced with HTML escape sequences.

Returns

A string containing the original text plus HTML escape sequences.

See Also

EscapeJavascriptString, EscapeWML.

Click to jump to top of pageClick to jump to parent topicEscapeJavascriptString

Syntax

EscapeJavascriptString(String)

Description

Use the EscapeJavascriptString function to replace the characters in String that have special meaning in a JavaScript string as escape sequences.

For example, a single quotation mark` ( ' ) is replaced by \', a new line character is replaced by \n, and so on.

This function is for use with text that becomes part of a JavaScript program.

The characters that are replaced are ones that cause the browser to misinterpret the JavaScript if they aren't encoded. This function is intended to make the text “browser safe.” The table below shows the strings that are replaced by this function, and their replacement character sequence.

Character Name

Glyph

Description

Apostrophe, single quote

'

\'

Quotation mark

"

\"

New line

Not applicable

\n

Carriage return

Not applicable

Deleted

Double backslash

\\

\\\\

Parameters

String

Specify a string that contains character that need to be replaced with JavaScript escape sequences.

Returns

A string containing the original text plus JavaScript escape sequences.

See Also

EscapeHTML, EscapeWML.

Click to jump to top of pageClick to jump to parent topicEscapeWML

Syntax

EscapeWML(String)

Description

Use the EscapeWML function to escape special characters that are significant to WML. This includes <, >, $ (escaped as $$), &, ' and ".

This function is for use with strings that display on an WML browser.

Parameters

String

Specify a string that contains characters that need to be replaced with WML escape sequences.

Returns

A string containing the original plus text plus WML escape sequences.

See Also

EscapeHTML, EscapeJavascriptString.

Click to jump to top of pageClick to jump to parent topicEvaluate

Syntax

Evaluate left_term When [relop_1] right_term_1 [statement_list] . . .

[When [relop_n] right_term_n [statement_list]] [When-other [statement_list]] End-evaluate

Description

Use the Evaluate statement to check multiple conditions. It takes an expression, left_term, and compares it to compatible expressions (right_term) using the relational operators (relop) in a sequence of When clauses. If relop is omitted, then = is assumed. If the result of the comparison is True, it executes the statements in the When clause, then moves on to evaluate the comparison in the following When clause. It executes the statements in all of the When clauses for which the comparison evaluates to True. If and only if none of the When comparisons evaluates to True, it executes the statement in the When-other clause (if one is provided).

To end the Evaluate after the execution of a When clause, you can add a Break statement at the end of the clause.

Considerations Using When Clause

Generally, you use the When clause without a semicolon at the end of the statement. However, in certain circumstances, this can cause an error. For example, the following PeopleCode produces an error because the PeopleCode compiler cannot separate the end of the Where clause with the beginning of the next statement:

When = COMPONENT.GARBAGE (create BO_SEARCH:Runtime:BusinessContact_Contact(&fBusObjDescr, Null, &fDerivedBOID, &fDerivedBORole, &fBusObjDescr1, Null, &fContactBOID, &fContactRoleID, &fCustBOID, &fCustRoleID, "")).SearchItemSelected(); End-Evaluate;

If you place a semicolon after the When clause, the two expressions are read separately by the compiler. For example:

When = COMPONENT.GARBAGE;

Example

The following is an example of a When statement taken evaluates ACTION and performs various statements based on its value:

&PRIOR_STATUS = PriorEffdt(EMPL_STATUS); Evaluate ACTION When "HIR" If %Mode = "A" Then Warning MsgGet(1000, 13, "You are hiring an employee and Action is not set to Hire."); End-if; Break; When = "REH" If All(&PRIOR_STATUS) and not (&PRIOR_STATUS = "T" or &PRIOR_STATUS = "R" ) Then Error MsgGet(1000, 14, "Hire or Rehire action is valid only if employee status is Terminated or Retired."); End-if; Break; When-Other /* default code */ End-evaluate;

Click to jump to top of pageClick to jump to parent topicExact

Syntax

Exact(string1, string2)

Description

Use the Exact function to compare two text strings and returns True if they are the same, False otherwise. Exact is case-sensitive because it uses the internal character codes.

Returns

Returns a Boolean value: True if the two strings match in a case-sensitive comparison.

Example

The examples set &MATCH to True, then False:

&MATCH = Exact("PeopleSoft", "PeopleSoft"); &MATCH = Exact("PeopleSoft", "Peoplesoft");

See Also

Len, String.

%Substring

Click to jump to top of pageClick to jump to parent topicExec

Syntax

Exec(command_str [, parameter])

where parameter has one of the following formats:

Boolean constant

Exec_Constant + Path_Constant

Description

Exec is a cross-platform function that executes an external program on either UNIX or Windows.

This function has two parameter conventions in order to maintain upward compatibility with existing programs.

Note. All PeopleCode is executed on the application server. So if you're calling an interactive application, you receive an error. There shouldn't be any application interaction on the application server console.

The function can make either a synchronous or asynchronous call. Synchronous execution acts as a "modal" function, suspending the PeopleSoft application until the called executable completes. This is appropriate if you want to force the user (or the PeopleCode program) to wait for the function to complete its work before continuing processing. Asynchronous processing, which is the default, launches the executable and immediately returns control to the calling PeopleSoft application.

If Exec is unable to execute the external program, the PeopleCode program terminates with a fatal error. You may want to try to catch these exceptions by enclosing such statements in a try-catch statement (from the Exception Class).

Using an Absolute Path

If you don't specify anything for the second parameter, or if you specify a Boolean value, the path to PS_HOME is prefixed to the command_str.

If you specify constant values for the second parameter, PS_HOME may or may not be prefixed, depending on the values you select.

You can use the GetEnv function to determine the value of PS_HOME.

Restrictions on Use in PeopleCode Events

When Exec is used to execute a program synchronously (that is, if its synch_exec parameter is set to True) it behaves as a think-time function, which means that it can’t be used in any of the following PeopleCode events:

See Also

Think-Time Functions.

Parameters

command_str

Specify a string containing the path and name of the executable file.

Boolean | Constants

If you specify a Boolean value, it indicates whether to execute the external program synchronously or asynchronously. Values are:

  • True - Synchronous

  • False - Asynchronous (default)

If you don't specify a value, the program executes asynchronously.

If you use this style, PS_HOME is always prefixed to command_str.

If you specify constant values, you're specifying a numeric value composed of an exec_constant and a path_constant. The exec_constant specifies whether to execute the external program synchronously or not. The path_constant specifies how the path name is to be treated. The value specified is made up of the addition of these predefined constants.

The function automatically converts the first token on command_str platform-specific separator characters to the appropriate form for where your PeopleCode program is executing, regardless of the path_constant. On a WIN32 system, a UNIX "/" separator is converted to "\", and on a UNIX system, a WIN32 "\" separator is converted to "/".

This is only done for the first token on command_str assuming it to be some sort of file specification. This allows you to put file or program names in canonical form (such as, Unix style) as the first token on the exec command. For example:

&ExitCode = Exec("/ourbin/magicprogram ....", %Exec_Synchronous + %FilePath_Absolute);

Values are:

 

Exec Constant

Description

%Exec_Asynchronous

Program executes asynchronously (the default)

%Exec_Synchronous

Program executes synchronously.

 

Path Constant

Description

%FilePath_Relative

PS_HOME is prefixed to command_str.

%FilePath_Absolute

Nothing is prefixed to command_str.

Returns

What is returned depends on what you specified for the second parameter.

If you specified a Boolean, a Number value equal to the process ID of the called process is returned.

If you specify constant values, the returned value contains the value of the exit code of the program executed using this function, unless you have executed the program asynchronously.

Example

&ExitCode = Exec("sh -c " | &scriptFile, %Exec_Synchronous + %FilePath_Absolute);

See Also

Declare Function, RemoteCall, WinExec, ScrollSelect, ScrollSelectNew, RowScrollSelect, RowScrollSelectNew, GetEnv.

Select

Exception Class

Think-Time Functions

Click to jump to top of pageClick to jump to parent topicExecuteRolePeopleCode

Syntax

ExecuteRolePeopleCode(RoleName)

Description

Use the ExecuteRolePeopleCode function to execute the PeopleCode Rule for the Role RoleName. This function returns an array of string containing dynamic members (UserIds).

Typically, this function is used by an Application Engine process that runs periodically and executes the role rules for different roles. It could then write the results of the rules (a list of users) into the security tables, effectively placing users in certain roles based on the rule.

Parameters

RoleName

Specify the name of an existing role.

Returns

An array of string containing the appropriate UserIds.

Example

The following saves valid users to a temporary table:

Local array of string &pcode_array_users; SQLExec("delete from ps_dynrole_tmp where ROLENAME=:1", &ROLENAME); If &pcode_rule_status = "Y" Then SQLExec("select RECNAME, FIELDNAME, PC_EVENT_TYPE, PC_FUNCTION_NAME from PSROLEDEFN where ROLENAME= :1", &ROLENAME, &rec, &fld, &pce, &pcf); If (&rec <> "" And &fld <> "" And &pce <> "" And &pcf <> "") Then &pcode_array_users = ExecuteRolePeopleCode(&ROLENAME); &pcode_results = True; Else &pcode_results = False; End-If; &comb_array_users = &pcode_array_users; End-If;

See Also

ExecuteRoleQuery, ExecuteRoleWorkflowQuery, IsUserInPermissionList, IsUserInRole.

%Roles

Understanding PeopleSoft Security

Click to jump to top of pageClick to jump to parent topicExecuteRoleQuery

Syntax

ExecuteRoleQuery(RoleName, BindVars)

where BindVars is an arbitrary-length list of bind variables that are stings in the form:

bindvar1 [, bindvar2]. . .

Description

Use the ExecuteRoleQuery function to execute the Query rule for the role rolename, passing in BindVars as the bind variables. This function returns an array object containing the appropriate user members (UserIds).

Parameters

RoleName

Specify the name of an existing role.

BindVars

A list of bind variables to be substituted in the query. These bind variables must be strings. You can't use numbers, dates, and so on.

Returns

An array object containing the appropriate UserIds.

See Also

ExecuteRolePeopleCode, ExecuteRoleWorkflowQuery, IsUserInPermissionList, IsUserInRole.

%Roles

Understanding PeopleSoft Security

Click to jump to top of pageClick to jump to parent topicExecuteRoleWorkflowQuery

Syntax

ExecuteRoleWorkflowQuery(RoleName, BindVars)

where BindVars is an arbitrary-length list of bind variables in the form:

bindvar1 [, bindvar2]. . .

Description

Use the ExecuteRoleWorkflowQuery function to execute the Workflow Query rule for the role rolename, passing in BindVars as the bind variables. This function returns an array object containing the appropriate user members (UserIds).

Parameters

RoleName

Specify the name of an existing role.

BindVars

A list of bind variables to be substituted in the query.

Returns

An array object containing the appropriate UserIds.

See Also

ExecuteRolePeopleCode, ExecuteRoleQuery, IsUserInPermissionList, IsUserInRole.

%Roles

Understanding PeopleSoft Security

Click to jump to top of pageClick to jump to parent topicExit

Syntax

Exit([1])

Description

Use the Exit statement to immediately terminate a PeopleCode program. If the Exit statement is executed within a PeopleCode function, the main program terminates.

Note. Exit(1) does not rollback iScript transactions. To rollback in an iScript, you can use the SqlExec built-in function with the parameter of ROLLBACK (SQLEXEC("ROLLBACK")) or the MessageBox built-in function with a message error severity of error. You can also use the built-in function Error, but only if you are not sending HTML or XML in the error text itself.

Parameters

1

Use this parameter to rollback database changes.

Generally, this parameter is used in PeopleCode programs that affect messages. When used with a message, all database changes are rolled back, errors for the subscription contract are written to the subscription contract error table, and the status of the message is marked to Error. All errors that have occurred for this message are viewable in the message monitor: even those errors detected by the ExecuteEdits method.

Note. This function takes only numeric values. It fails if you use a Boolean value, True or False.

Returns

None.

Example

The following example terminates the main program from a For loop:

For &I = 1 To ActiveRowCount(RECORD.SP_BUIN_NONVW) &ITEM_SELECTED = FetchValue(ITEM_SELECTED, &I); If &ITEM_SELECTED = "Y" Then &FOUND = "Y"; Exit; End-If; End-For;

See Also

Break, Return.

Click to jump to top of pageClick to jump to parent topicExp

Syntax

Exp(n)

Description

Exp returns the constant e raised to the power of n where n is a number. The constant e equals 2.71828182845904, the base of natural logarithms. The number n is the exponent applied to the base e.

Exp is the inverse of the Ln function, which is the natural logarithm of x.

Returns

Returns a Number value equal to the constant e raised to the power of n.

Example

The examples set &NUM to 2.71828182845904, then 7.389056099(e2):

&NUM = Exp(1); &NUM = Exp(2);

See Also

Ln, Log10.

Click to jump to top of pageClick to jump to parent topicExpandBindVar

Syntax

ExpandBindVar(str)

Description

Inline bind variables can be included in any PeopleCode string. An inline bind variable is a field reference (in the form recordname.fieldname), preceded by a colon. The inline bind variable references the value in the field.

Use the ExpandBindVar function to expand any inline bind variables that it finds in str into strings (converting the data type of non-character fields) and returns the resulting string. This works with inline bind variables representing fields containing any data type except Object. It also expands bind variables specified using additional parameters.

See SQLExec.

Parameters

str

A string containing one or more inline bind variables.

Returns

Returns a String value equal to the input string with all bind variables expanded.

Example

A bind variable is included in the string &TESTSTR, which is then expanded into a new string containing the current value of BUS_EXPENSE_PER.EMPLID in place of the bind variable. If this program runs on the row for EMPLID 8001, the message displayed reads "This is a test using EmplID 8001".

&TESTSTR = "This is a test using EmplID :bus_expense_per.emplid"; &RESULT = ExpandBindVar(&TESTSTR); WinMessage(&RESULT);

See Also

MessageBox, SQLExec.

Click to jump to top of pageClick to jump to parent topicExpandEnvVar

Syntax

ExpandEnvVar(string)

Description

Use the ExpandEnvVar function to convert any environment variables that it finds within string into String values and returns the entire resulting string.

Parameters

string

A string containing an environment variable.

Returns

Returns a string equal to string with any enclosed environment variables expanded to their values.

Example

Assume that the environment variable %NETDRIVE% is equal to "N:". The following PeopleCode sets &newstring equal to "The network drive is equal to N:":

&newstring = ExpandEnvVar("The network drive is equal to %netdrive%.");

See Also

ExpandBindVar, GetEnv, GetCwd.

Click to jump to top of pageClick to jump to parent topicExpandSqlBinds

Syntax

ExpandSqlBinds(string)

Description

Prior to PeopleTools 8.0, the PeopleCode replaced runtime parameter markers in SQL strings with the associated literal values. For databases that offer SQL statement caching, a match was never found in the cache so the SQL had to be re-parsed and re-assigned a query path.

To process skipped parameter markers, each parameter marker is assigned a unique number. This doesn’t change the values associated with the parameter markers.

However, some SQL statements can’t contain parameter markers because of database compatibility.

To process these exceptions, use the ExpandSqlBinds function. This function does the bind variable reference expansion, and can be used within a SQLExec statement or on its own.

You should use ExpandSQLBinds only for those parts of the string that you want to put literal values into. The following code shows how to use ExpandSQLBinds with %Table:

SQLExec(ExpandSqlBinds("Insert.... Select A.Field, :1, :2 from ", "01", "02") | "%table(:1)", Record.MASTER_ITEM_TBL);

Parameters

string

Specify the string you want to do the bind variable reference expansion on.

Returns

A string.

Example

The following example shows both the original string and what it expands to.

&NUM = 1; &STRING = "My String"; &STR2 = ExpandSqlBinds("This :2 is an expanded string(:1)", &STRING, &NUM);

The previous code produces the following value for &STR2:

This 1 is an expanded string(My String)

If you’re having problems with an old SQL statement binds, you can use ExpandSqlBinds with it. For example, if your SQLExec is this:

SQLExec("String with concatenated bindrefs ‘M’:2, ‘M’:1", &VAR1, &VAR2), &FETCHRESULT1, &FETCHRESULT2);

you can make it work by expanding it as follows:

SQLExec(ExpandSqlBinds("String with concatenated bindrefs ‘M’:2, ‘M’:1", &VAR1, &VAR2), &FETCHRESULT1, &FETCHRESULT2);

See Also

SQLExec.

SQL Class

Click to jump to top of pageClick to jump to parent topicFact

Syntax

Fact(x)

Description

Use the Fact function to return the factorial of a positive integer x. The factorial of a number x is equal to 1*2*3*...*x. If x is not an integer, it is truncated to an integer.

Returns

Returns a Number equal to the factorial of x.

Example

The example sets &X to 1, 1, 2, then 24. Fact(2) is equal to 1*2; Fact(4) is equal to 1*2*3*4:

&X = Fact(0); &X = Fact(1); &X = Fact(2); &X = Fact(4);

See Also

Product.

Click to jump to top of pageClick to jump to parent topicFetchSQL

Syntax

FetchSQL([SQL.]sqlname[, dbtype[, effdt]] )

Description

Use the FetchSQL function to return the SQL definition with the given sqlname as SQL.sqlname or a string value, matching the dbtype and effdt. If sqlname is a literal name, it must be in quotes.

Parameters

sqlname

Specify the name of a SQL definition. This is either in the form SQL.sqlname or a string value giving the sqlname.

dbtype

Specify the database type associated with the SQL definition. This parameter takes a string value. If dbtype isn’t specified or is null (""), it is set by default to the current database type (the value returned from the %DbType system variable.)

Values for dbtype are as follows. These values are not case-sensitive:

  • APPSRV

  • DB2ODBC

  • DB2UNIX

  • INFORMIX

  • MICROSFT

  • ORACLE

  • SYBASE

Note. Database platforms are subject to change.

effdt

Specify the effective date associated with the SQL definition. If effdt isn’t specified, it is set by default to the current as of date, that is, the value returned from the %AsOfDate system variable.

Returns

The SQL statement associated with sqlname as a string.

Example

The following code gets the text associated with the ABCD_XY SQL Definition for the current DBType and as of date:

&SQLSTR = FetchSQL(SQL.ABC_XY);

The following code gets the text associated with the ABCD_XY SQL Definition for the current DBType and November 3, 1998:

&SQLSTR = FetchSQL(SQL.ABCD_XY, "", Date(19981103));

See Also

CreateSQL, DeleteSQL, SQLExec, GetSQL, StoreSQL.

SQL Class

%AsOfDate, %DbName.

Click to jump to top of pageClick to jump to parent topicFetchValue

Syntax

FetchValue(scrollpath, target_row, [recordname.]fieldname)

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 FetchValue function to return the value of a buffer field in a specific row of a scroll level.

Note. This function remains for backward compatibility only. Use the Value field class property instead.

This function is generally used to retrieve the values of buffer fields outside the current context; if a buffer field is in the current context, you can reference it directly using a [recordname.]fieldname expression.

See Also

Value.

LongTranslateValue

ShortTranslateValue

Accessing the Data Buffer

Specifying Data with References Using Scroll Path Syntax and Dot Notation

Parameters

scrollpath

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

target_row

An integer specifying the row on the target scroll level where the referenced buffer field is located.

[recordname.]fieldname

The name of the field where the value to fetch is located. The field can be on scroll level one, two, or three of the active page. The recordname prefix is required if the call to FetchValue is in a record definition other than recordname.

Returns

Returns the field value as an Any data type.

Example

The following example retrieves the value from field DEPEND_ID in record DEPEND on row &ROW_CNT from scroll level one:

&VAL = FetchValue(SCROLL.DEPEND, &ROW_CNT, DEPEND.DEPEND_ID);

See Also

ActiveRowCount, CopyRow, CurrentRowNumber, PriorValue, UpdateValue.

Referencing Data in the Component Buffer

Click to jump to top of pageClick to jump to parent topicFieldChanged

Syntax

The syntax of the FieldChanged function varies depending on whether you want to use a scroll path reference or a contextual reference to specify the field.

If you want to use a scroll path reference, the syntax is:

FieldChanged(scrollpath, target_row, [recordname.]fieldname)

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.

If you want to use a contextual reference, the syntax is:

FieldChanged([recordname.]fieldname)

In this construction the scroll level and row number are determined based on the current context.

Description

The FieldChanged function returns True if the referenced buffer field has been modified since being retrieved from the database either by a user or by a PeopleCode program.

Note. This function remains for backward compatibility only. Use the IsChanged field class property instead.

This is useful during SavePreChange or SavePostChange processing for checking whether to make related updates based on a change to a field.

See Also

IsChanged.

Accessing the Data Buffer

Specifying Data with References Using Scroll Path Syntax and Dot Notation

Parameters

scrollpath

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

[recordname.]fieldname

The name of the field where the value to check is located. The field can be on scroll level one, two, or three of the active page. The recordname prefix is required if the call to FieldChanged is in a record definition other than recordname.

target_row

The row number of the target row. If this parameter is omitted, the function assumes the row on which the PeopleCode program is executing.

Related Functions

Save PeopleCode programs (SaveEdit, SavePreChange, SavePostChange) normally process each row of data in the component. The following four functions enable you to control more precisely when the Component Processor should perform save PeopleCode:

These functions enable you to restrict save program processing to specific rows.

Example

The following example checks three fields and sets a flag if any of them has changed:

/* Set the net change flag to 'Yes' if the scheduled date, scheduled */ /* time or quantity requested is changed */ If FieldChanged(QTY_REQUESTED) Or FieldChanged(SCHED_DATE) Or FieldChanged(SCHED_TIME) Then NET_CHANGE_FLG = "Y"; End-If;

See Also

RecordChanged, RecordDeleted, RecordNew.

Click to jump to top of pageClick to jump to parent topicFileExists

Syntax

FileExists(filename [, pathtype])

Description

Use the FileExists function to determine whether a particular external file is present on your system, so you can decide which mode to use when you open the file for writing.

Note. If you want to open a file for reading, you should use the GetFile function or the Open File Class method with the "e" mode, which prevents another process from deleting or renaming the file between the time you tested for the file and when you open it.

Working With Relative Paths

If you specify a relative path, that path is appended to the path specified by an environmental variable, if the variable exists, in a particular order. This means if the first environmental variable in order is found, that is the one that's used. If it isn't found, the next one is searched for, and if found, is used, and so on.

The environmental variables that get used are different, depending on whether the machine where the code is running is an application server or not. If the code is running on an application server, the following environmental variables are valid, and are searched for in the following order:

  1. PS_FILEDIR[\relative_path]

  2. PS_SERVDIR\Files[\relative_path]

If the code is not running on an application server, the following environmental variables are valid, and are searched for in the following order:

  1. PS_FILEDIR[\relative_path]

  2. PS_SERVDIR\Files[\relative_path]

  3. TEMP[\relative_path]

The PS_FILEDIR environmental variable is not initialized and set to a path automatically. If you want to use this environmental variable, you must set it yourself.

Note. Your system security should verify if a user has the correct permissions before allowing access to a drive (for example, if a user changes their TEMP environmental variable to a network drive they don’t normally have access to, your system security should detect this.)

Parameters

filespec

Specify the name, and optionally, the path, of the file you want to test.

pathtype

If you have prepended a path to the file name, 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 the path is an absolute path, whatever path you specify is used verbatim. You must specify a drive letter as well as the complete path. You can’t use any wildcards when specifying a path.

The function automatically converts platform-specific separator characters to the appropriate form for where your PeopleCode program is executing. On a WIN32 system, UNIX "/" separators are converted to "\", and on a UNIX system, WIN32 "\" 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 the PeopleCode is executing.

Returns

A Boolean value: True if the file exists, False if it doesn’t.

Example

The following example opens a file for appending if it exists on the system:

If FileExists("c:\work\item.txt", %FilePath_Absolute) Then &MYFILE = GetFile("c:\work\item.txt", "A"); /* Process the file */ &MYFILE.Close(); End-If;

See Also

FindFiles, GetFile.

File Class

Open

Click to jump to top of pageClick to jump to parent topicFind

Syntax

Find(string, within_string [, number])

Description

Use the Find function to locate one string of text within another string of text and returns the character position of the string as an integer. Find is case-sensitive and does not allow wildcards.

If you need to do either case-sensitive search or pattern matching, just to find if a string matches a pattern, use the DBPatternMatch function.

If you need to find a quotation mark, you need to double it in a string.

&find = Find("""", PSOPRDEFN_SRCH.OPRID);

Parameters

string

The text you are searching for.

A tilde character (~) used in the string parameter stands for an arbitrary number of white spaces.

within_string

The text string you are searching within.

number

The position of within_string at which you want to start your search. If you omit number, Find starts at the first character of within_string.

Returns

Returns a Number value indicating the starting position of string in within_string.

Find returns with 0 if string does not appear in within_string, if number is less than or equal to zero, or if number is greater than the length of within_string.

Example

In the following example, the first statement returns 1; the second statement returns 6.

&POS = Find("P", "PeopleSoft") &POS = Find("e", "PeopleSoft", 4)

See Also

Exact, Len, DBPatternMatch.

Click to jump to top of pageClick to jump to parent topicFindb

Syntax

Findb(string, within_string [, number])

Description

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

Click to jump to top of pageClick to jump to parent topicFindCodeSetValues

Syntax

FindCodeSetValues(CodesetName, &NameValuePairs, SourceNodeName, TargetNodeName)

Description

Use the FindCodeSetValues function to find a list of code set name-value pairs. Code sets are primarily used with data value translations as part of a transformation.

Parameters

CodeSetName

Specify the name of the code set you want to find, as a string.

&NameValuePairs

Specify a 2 dimensional array containing the name value pairs in the specified code set that you want to use.

SourceNodeName

Specify the name of the source (initial) node used in the data transformation.

TargetNodeName

Specify the name of the target (result) node used in the data transformation.

Returns

A two-dimensional array of any.

Example

This example checks the specified CodeSet values, with the name value pairs of "locale/en_us" and "uom/box". It takes the returned array and adds XML nodes to the document. The XML nodes names are the unique names of the CodeSet value, and the XML node value is the corresponding return value.

/* Get the data from the AE Runtime */ Local TransformData &incomingData = %TransformData; /* Set a temp object to contain the incoming document */ Local XmlDoc &tempDoc = &incomingData.XmlDoc; /* Declare the node */ Local XmlNode &tempNode; /* Create an array to hold the name value pairs */ Local array of array of string &inNameValuePairsAry; /* Clear out the doc and put in a root node */ If (&tempDoc.ParseXmlString("<?xml version=""1.0""?><xml/>")) Then /* Load the array with some values */ &inNameValuePairsAry = CreateArray(CreateArray("locale", "en_us"), CreateArray("uom", "box")); /* Find the codeset values */ &outAry = FindCodeSetValues("PS_SAP_PO_01", &inNameValuePairsAry, "SAP_SRC", "PSFT_TGT"); /* Local XmlNode &tempNode; */ /* Make sure something was returned */ If &outAry.Len > 0 Then /* Loop through the quantities and make sure they are all above 5 */ For &i = 1 To &outAry.Len /* Add the current system date to the working storage*/ &tempNode = &tempDoc.DocumentElement.AddElement(&outAry [&i][1]); &tempNode.NodeValue = &outAry [&i][2]; End-For; End-If; End-If;

See Also

Array Class.

Applying Filtering, Transformation and Translation

Click to jump to top of pageClick to jump to parent topicFindFiles

Syntax

FindFiles(filespec_pattern [, pathtype])

Description

Use the FindFiles function to return a list of the external filenames that match the filename pattern you provide, in the location you specify.

Working With Relative Paths

If you specify a relative path, that path is appended to the path specified by an environmental variable, if the variable exists, in a particular order. This means if the first environmental variable in order is found, that is the one that's used. If it isn't found, the next one is searched for, and if found, is used, and so on.

The environmental variables that are used are different, depending on whether the machine where the code is running is an application server. If the code is running on an application server, the following environmental variables are valid, and are searched for in the following order:

  1. PS_FILEDIR[\relative_path]

  2. PS_SERVDIR\Files[\relative_path]

If the code is not running on an application server, the following environmental variables are valid, and are searched for in the following order:

  1. PS_FILEDIR[\relative_path]

  2. PS_SERVDIR\Files[\relative_path]

  3. TEMP[\relative_path]

The PS_FILEDIR environmental variable is not initialized and set to a path automatically. To use this environmental variable, you must set it yourself.

Note. Your system security should verify if a user has the correct permissions before allowing access to a drive (for example, if a user changes their TEMP environmental variable to a network drive they don’t normally have access to, your system security should detect this.)

Parameters

filespec_pattern

Specify the path and filename pattern for the files you want to find. The path can be any string expression that represents a single relative or absolute directory location. The filename pattern, but not the path, can include two wildcards:

* (Asterisk): matches zero or more characters at its position.

? (Question mark): matches exactly one character at its position.

pathtype

If you have prepended a path to the file name, 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 the path is an absolute path, whatever path you specify is used verbatim. You must specify a drive letter as well as the complete path. You can't use any wildcards when specifying a path.

The function automatically converts platform-specific separator characters to the appropriate form for where your PeopleCode program is executing. On a WIN32 system, UNIX "/" separators are converted to "\", and on a UNIX system, WIN32 "\" 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 the PeopleCode is executing.

Returns

A string array whose elements are filenames qualified with the same relative or absolute path you specified in the input parameter to the function.

Example

The following example finds all files in the system’s TEMP location whose names end with ".txt", then opens and processes each one in turn:

Local array of string &FNAMES; Local file &MYFILE; &FNAMES = FindFiles("\*.txt"); while &FNAMES.Len > 0 &MYFILE = GetFile(&FNAMES.Shift(), "R"); /* Open each file */ /* Process the file contents */ &MYFILE.Close(); end-while;

See Also

FileExists, GetFile.

File Class

Array Class

Click to jump to top of pageClick to jump to parent topicFlushBulkInserts

Syntax

FlushBulkInserts()

Description

Use the FlushBulkInserts function to move the bulk inserted rows from the bulk insert buffers of the PeopleSoft process to the physical tables on the database. This flushes all open SQL objects that have pending bulk inserts, but performs no COMMITs. If the flush fails, the PeopleCode program terminates.

When executing a SQL insert using a SQL object with the BulkMode property set to True, the rows being inserted cannot be selected by this database connection until the bulk insert is flushed. For another connection to the database to be able to select those rows, both a flush and a COMMIT are required. To have your process see the bulk inserted rows without committing and without closing the SQL object or its cursor (that is, maintaining reuse for the SQL object), use FlushBulkInserts.

An example of using this function would be in preparation for a database commit where you do not want to close the SQL insert statement, but need to ensure that all the rows you have inserted up to this point are in fact in the database and not in the buffer.

Another example would be when another SQL statement in the same PeopleSoft process needs to select rows that have been inserted using bulk insert and you do not want to close the SQL insert statement. The SELECT cannot read rows in the bulk insert buffer, so you need to flush them to the table from which the SELECT is reading.

Parameters

None.

Returns

None. If the flush fails, the PeopleCode program terminates.

Example

&CM_DEPLETION_REC = CreateRecord(Record.CM_DEPFIFO_VW); &CM_DEPLETE_REC = CreateRecord(Record.CM_DEPLETE); &DEPLETE_FIFO_SEL = GetSQL(SQL.CM_DEPLETE_FIFO_SEL); &ONHAND_FIFO_SEL = GetSQL(SQL.CM_ONHAND_FIFO_SEL); DEPLETE_INS = GetSQL(SQL.CM_DEPLETE_INS); &DEPLETE_INS.BulkMode = True; &DEPLETE_FIFO_SEL.Execute(&CM_DEPLETION_REC, CM_COSTING_AET.BUSINESS_UNIT, CM_COSTING_AET.CM_BOOK); While &DEPLETE_FIFO_SEL.Fetch(&CM_DEPLETION_REC); /* Call functions that populate &CM_DEPLETE_REC.values */ . . . &DEPLETE_INS.Execute(&CM_DEPLETE_REC); . . . If &CM_DEPLETION_REC.CM_COST_PROC_GROUP.Value = "BINTOBIN" Then /* Bin to Bin transfers are both a deplete and receipt, call functions to create the receipt */ . . . /* Flush Bulk Insert to be able to see the current on hand quantities in CM_ONHAND_VW */ FlushBulkInserts(); End-if; End-While; . . .

See Also

Applying Filtering, Transformation and Translation.

Click to jump to top of pageClick to jump to parent topicFor

Syntax

For count = expression1 To expression2 [Step i]; statement_list End-for

Description

Use the For loop to cause the statements of the statement_list to be repeated until count is equal to expression2. Step specifies the value by which count will be incremented each iteration of the loop. If you do not include Step, count is incremented by 1 (or -1 if the start value is greater than the end value.) Any statement types are allowed in the loop, including other loops.

A Break statement inside the loop causes execution to continue with whatever follows the loop. If the Break occurs in a nested loop, the Break does not apply to the outside loop.

Example

The following example loops through all of the rows for the FIELDNAME scroll area:

&FIELD_CNT = ActiveRowCount(DBFIELD_VW.FIELDNAME); For &I = 1 to &FIELD_CNT; WinMessage(MsgGetText(21000, 1, "Present Row Number is: %1", &I)); End-for;

Click to jump to top of pageClick to jump to parent topicFormatDateTime

Syntax

FormatDateTime(datetime, {timezone | "Local" | "Base"}, displayTZ)

Description

Use the FormatDateTime function to take a datetime value and convert it to text. If a specific time zone abbreviation, or a field reference, is passed in timezone, FormatDateTime adjusts the datetime to the user’s local time zone instead of the specified time zone. The system’s base time zone is specified on the PSOPTIONS table. The value datetime is assumed to be in base time.

See Using PeopleTools Utilities.

If Local is specified for time zone, FormatDateTime adjusts the datetime to the user’s local time zone instead of a specific time zone.

If True is specified for displayTZ, FormatDateTime appends the time zone abbreviation to the returned string.

Parameters

datetime

Specify the datetime value to be formatted.

timezone | Local | Base

Specify a value for converting datetime. The 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.

displayTZ

Specify whether the time zone abbreviation should be appended to the returned string. This parameter takes a Boolean: True if the abbreviation should be appended, False, otherwise.

Returns

A formatted string value.

Example

The following example populates the &DISPDATE variable with a string containing the datetime value in the ORDER_DATE field adjusted to the user’s local time zone, and with the time zone abbreviation.

&DISPDATE=FormatDateTime(ORDER_DATE, "Local", True);

The following example populates the &DISPDATE variable with a string containing the datetime value in the SHIP_DATE field adjusted to the time zone stored in the SHIP_TZ field, and does not include the time zone abbreviation in the output.

&DISPDATE=FormatDateTime(SHIP_DATE, SHIP_TZ, False);

See Also

ConvertDatetimeToBase, ConvertTimeToBase, DateTimeToLocalizedString, IsDaylightSavings, DateTimeToTimeZone, TimeToTimeZone, TimeZoneOffset, DateTimeToHTTP.

Click to jump to top of pageClick to jump to parent topicForward

Syntax

Forward(from physical queue ID, from agent ID, task number, task type, to logical queue ID[, to agent ID])

Description

Use the Forward function to transfer a task from one agent to another agent or from one agent's logical queue to another logical queue. This enables agents to reroute tasks that are not appropriate for their skill level or functional expertise.

Keep the following in mind when using Forward:

Parameters

from physical queue ID

The physical queue is the internal representation of the logical queue that the agent signs onto and to which the task currently belongs. This is a string value, such as “sales3” or “marketing2.”

You retrieve the current physical queue from the query string in the URL of the page launched by the MultiChannel Framework console. Use the GetParameter request class method with the value ps_qid

from agent ID

Specifies the current agent, as in the agent that “accepted” the task. This is a string value.

You retrieve the current physical queue from the query string in the URL of the page launched by the MultiChannel Framework console. Use the GetParameter request class method with the value ps_agentid.

task number

Identifies the task to be forwarded. The EnQueue function returns this value. This is a string value.

You retrieve the current physical queue from the query string in the URL of the page launched by the MultiChannel Framework console. Use the GetParameter request class method with the value ps_tasknum.

task type

Identifies the task type. This value is provided by the queue. This is a string value. Valid values are:

  • email

  • generic

You retrieve the current physical queue from the query string in the URL of the page launched by the MultiChannel Framework console. Use the GetParameter request class method with the value ps_tasktype.

to logical queue ID

Specifies the logical queue to which the system forwards the task. This is a string value.

The queue ID is case sensitive and must match the case used when you created the queue using the Queues page.

to agent ID

This is an optional parameter. It is a string value specifying a particular agent ID to receive the forwarded task.

If this value is specified, the system holds the task until the specified agent is available on the new queue to take this task. This means that the specified agent must be able to log in to one of the physical queues belonging to the destination logical queue. The system determines which physical queue the specified agent has access to and assigns the task to that queue for that agent. If the agent ID is not specified, the physical queue is chosen at random from the active physical queues.

Note. For better performance, PeopleSoft recommends not specifying the target agent as this has a processing overhead for the queue servers and does not allow the system to balance workload across all available agents.

Returns

Returns 0 on success.

If unsuccessful, it returns a message number. The message set ID for MultiChannel Framework is 162.

For example, 1302 is returned when an invalid task type or no value is provided.

Example

Forward("SALES5", "TSAWYER", "email_2145", "email", "MARKETING", "GSALMON");

The following example shows how to retrieve parameters from the application page using the GetParameter request class method.

PSMCFFUNCLIB.MCF_QUEUE.Value = %Request.GetParameter("ps_qid"); PSMCFFUNCLIB.MCF_TASKTYPE.Value = %Request.GetParameter("ps_tasktype"); PSMCFFUNCLIB.MCF_TASKNUM.Value = %Request.GetParameter("ps_tasknum"); PSMCFFUNCLIB.MCF_AGENTID.Value = %Request.GetParameter("ps_agentid"); &nret = Forward(PSMCFFUNCLIB.MCF_QUEUE, PSMCFFUNCLIB.MCF_AGENTID, PSMCFFUNCLIB.MCF_TASKNUM, PSMCFFUNCLIB.MCF_TASKTYPE, &ToQueue); If &nret = 0 Then MessageBox(0, "", 0, 0, "Successfully forwarded."); End-If

Click to jump to top of pageClick to jump to parent topicFunction

Syntax

Function name [(paramlist)] [Returns data_type] [statements] End-function

Where paramlist is:

&param1 [As data_type] [, &param2 [As data_type]]...

Where data_type is any valid data type, including Number, String, Date, Rowset, SQL, Record, and so on.

Where statements is a list of PeopleCode statements.

Description

PeopleCode functions can be defined in any PeopleCode program. Function definitions must be placed at the top of the program, along with any variable and external function declarations.

Functions can be called from the program in which they are defined, in which case they don’t need to be declared, and they can be called from another program, in which case they need to be declared at the top of the program where they are called.

Any variables declared within a function are valid for the scope of the function.

By convention, external PeopleCode functions are stored in records whose names begin in FUNCLIB_, and they are always placed in the FieldFormula event (which is convenient because this event should no longer be used for anything else).

Note. Functions can be stored in the FieldFormula event only for record fields, not for component record fields.

A function definition consists of:

The parameter list, which must be enclosed in parentheses, is a comma-separated list of variable names, each prefixed with the & character. Each parameter is optionally followed by the keyword As and the name for one of the conventional PeopleCode data types (Number, String, Date, and so on) or any of the object data types (such as Rowset, SQL, and so on.) If you specify data types for parameters, then function calls are checked to ensure that values passed to the function are of the appropriate type. If data types are not specified, then the parameters, like other temporary variables in PeopleCode, take on the type of the value that is passed to them.

PeopleCode parameters are always passed by reference. This means that if you pass the function a variable from the calling routine and change the value of the variable within the function, the value of the variable is changed when the flow of execution returns to the calling routine.

If the function is to return a result to the caller, the optional Returns part must be included to specify the data type of the returned value. You have seven choices of value types: Number, String, Date, Time, DateTime, Boolean, or Any.

PeopleCode internal subroutines are part of the enclosing program and can access the same set of variables as the other statement-lists of the program, in addition to local variables created by the parameters and local variable declarations within the function.

Returning a Value

You can optionally return a value from a PeopleCode function. To do so, you must include a Return statement in the function definition, as described in the preceding section. For example, the following statement returns a Number value:

function calc_something(&parm1 as number, &parm2 as number) returns number

In the code section of your function, use the Return statement to return a value to the calling routine. When the Return statement executes, the function ends and the flow of execution goes back to the calling routine.

Example

This example returns a Boolean value based on the return value of a SQLExec:

function run_status_upd(&PROCESS_INSTANCE, &RUN_STATUS) returns Boolean; &UPDATEOK = SQLExec("update PS_PRCS_RQST set run_status = :1 where process_instance = :2", &RUN_STATUS, &PROCESS_INSTANCE); If &UPDATEOK Then Return True; Else Return False; End-if; End-function;

See Also

Declare Function, Return.

Click to jump to top of pageClick to jump to parent topicGenerateActGuideContentUrl

Syntax

GenerateActGuideContentlUrl(PORTAL.portalname, NODE.nodename, MENUNAME.menuname, Marketname, COMPONENT.componentname, ActivityGuide)

Description

Use the GenerateActGuideContentUrl function to create a URL string that represents an absolute reference to the specified activity guide (life event) for the content servlet. The ContentURI of the node that hosts the specified portal is used in the generated URL. The URL contains a reference to the content service (psc) servlet.

If you want to generate a URL for the portal service (psp) servlet, use the GenerateActGuidePortalURL function.

Parameters

portalname

Specify the name of the portal used for this request, prefixed with the reserved word PORTAL. You can also use a string, such as %Portal, for this value.

nodename

Specify the name of the node that contains the activity guide, prefixed with the reserved word NODE. You can also use a string, such as %Node, for this value.

menuname

Specify the name of the menu containing the activity guide, prefixed with the reserved word MENUNAME. You can also use a string, such as %Menu, for this value.

Marketname

Specify the name of the market of the component. You can also use a string, such as %Market, for this value.

ComponentName

Specify the name of the component, prefixed with the reserved word COMPONENT. You can also use a string, such as %Component, for this value.

ActivityGuide

Specify the name of the Activity Guide, as a string.

Returns

A string with the following format:

http://Content URI of node/portal/node/l/ActivityGuide.component.market

This function returns a Null string if you specify an invalid portal or node.

Example

The following code:

&AGURL = GenerateActGuideContentUrl(%Portal, %Node, MENUNAME.MAINTAIN_SECURITY, "GBL", COMPONENT.CHANGE_PASSWORD, "QE_ACTIVITY_GUIDE_DEMO");

might produce the following URL string:

http://boynten8700/psc/ps/EMPLOYEE/QE_LOCAL/l/QE_ACTIVITY_GUIDE_DEMO.MAINTAIN_SECURITY.CHANGE_PASSWORD.GBL

See Also

GenerateActGuidePortalUrl, GenerateActGuideRelativeUrl.

Designing Activity Guides

Click to jump to top of pageClick to jump to parent topicGenerateActGuidePortalUrl

Syntax

GenerateActGuidePortalUrl(PORTAL.portalname, NODE.nodename, MENUNAME.menuname, Marketname, COMPONENT.componentname, ActivityGuide)

Description

Use the GenerateActGuidePortalUrl function to create a URL string that represents an absolute reference to the specified activity guide (life event) for the portal servlet. The PortalURI of the node that hosts the specified portal is used in the generated URL. The URL contains a reference to the portal service (psp) servlet.

If you want to generate a URL for the portal content (psc) servlet, use the GenerateActGuideContentURL function.

Parameters

portalname

Specify the name of the portal used for this request, prefixed with the reserved word PORTAL. You can also use a string, such as %Portal, for this value.

nodename

Specify the name of the node that contains the activity guide, prefixed with the reserved word NODE. You can also use a string, such as %Node, for this value.

menuname

Specify the name of the menu containing the activity guide, prefixed with the reserved word MENUNAME. You can also use a string, such as %Menu, for this value.

Marketname

Specify the name of the market of the component. You can also use a string, such as %Market, for this value.

ComponentName

Specify the name of the component, prefixed with the reserved word COMPONENT. You can also use a string, such as %Component, for this value.

ActivityGuide

Specify the name of the Activity Guide, as a string.

Returns

A string with the following format:

http://Portal URI of node/portal/node/l/ActivityGuide.component.market

This function returns a Null string if you specify an invalid portal or node.

Example

The following code:

&AGURL = GenerateActGuidePortalUrl(%Portal, %Node, MENUNAME.MAINTAIN_SECURITY, "GBL", COMPONENT.CHANGE_PASSWORD, "QE_ACTIVITY_GUIDE_DEMO");

might create the following URL string:

http://boynte700/psp/ps/EMPLOYEE/QE_LOCAL/l/QE_ACTIVITY_GUIDE_DEMO.MAINTAIN_SECURITY.CHANGE_PASSWORD.GBL

See Also

GenerateActGuideContentUrl, GenerateActGuideRelativeUrl.

Designing Activity Guides

Click to jump to top of pageClick to jump to parent topicGenerateActGuideRelativeUrl

Syntax

GenerateActGuideRelativeUrl(PORTAL.portalname, NODE.nodename, MENUNAME.menuname, Marketname, COMPONENT.componentname, ActivityGuide)

Description

Use the GenerateActGuideContentUrl function to create a URL string that represents an relative reference to the specified activity guide (life event). The relative reference is suitable for use on any page that itself has the simple URL format.

Parameters

portalname

Specify the name of the portal used for this request, prefixed with the reserved word PORTAL. You can also use a string, such as %Portal, for this value.

nodename

Specify the name of the node that contains the activity guide, prefixed with the reserved word NODE. You can also use a string, such as %Node, for this value.

menuname

Specify the name of the menu containing the activity guide, prefixed with the reserved word MENUNAME. You can also use a string, such as %Menu, for this value.

Marketname

Specify the name of the market of the component. You can also use a string, such as %Market, for this value.

ComponentName

Specify the name of the component, prefixed with the reserved word COMPONENT. You can also use a string, such as %Component, for this value.

ActivityGuide

Specify the name of the Activity Guide, as a string.

Returns

A string with the following format:

../../../Portal/node/l/ActivityGuide.menu.component.market

This function returns a Null string if you specify an invalid portal or node.

Example

The following code:

&AGURL = GenerateActGuideRelativeUrl(%Portal, %Node, MENUNAME.MAINTAIN_SECURITY, "GBL", COMPONENT.CHANGE_PASSWORD, "QE_ACTIVITY_GUIDE_DEMO");

might produce the following URL string:

../../../EMPLOYEE/QE_LOCAL/l/QE_ACTIVITY_GUIDE_DEMO.MAINTAIN_SECURITY.CHANGE_PASSWORD.GBL

See Also

GenerateActGuideContentUrl, GenerateActGuidePortalUrl.

Designing Activity Guides

Click to jump to top of pageClick to jump to parent topicGenerateComponentContentRelURL

Syntax

GenerateComponentContentRelURL(PORTAL.portalname, NODE.nodename,MENUNAME.menuname, MARKET.marketname, COMPONENT.componentname, PAGE.pagename, action, [, keylist])

where keylist is a list of field references in the form:

[recordname.]field1 [, [recordname.]field2]. . .

OR

&RecordObject1 [, &RecordObject2]. . .

Description

Use the GenerateComponentContentRelURL function to create a URL string that represents a relative reference to the specified component for the content servlet. The relative reference is suitable for use on any page that itself has the simple URL format.

If you want to generate an absolute URL for a component, use the GenerateComponentContentURL function.

Note. PeopleSoft recommends using the Transfer function for opening new windows, not this function, as there may be problems maintaining state and window count.

Parameters

PortalName

Specify the name of the portal used for this request, prefixed with the reserved word PORTAL. You can also use a string, such as %Portal, for this value. This parameter is ignored by the content service, but is a required part of the psc URL format.

NodeName

Specify the name of the node that contains the content, prefixed with the reserved word NODE. You can also use a string, such as %Node, for this value.

MenuName

Specify the name of the menu containing the content, prefixed with the reserved word MENUNAME. You can also use a string, such as %Menu, for this value.

Marketname

Specify the name of the market of the component, prefixed with the reserved word MARKET. You can also use a string, such as %Market, for this value.

ComponentName

Specify the name of the component, prefixed with the reserved word COMPONENT. You can also use a string, such as %Component, for this value.

Pagename

Specify the name of the page that contains the content. If you specify a page name, it must be prefixed with the keyword PAGE. You can also specify an empty string ("") for this value.

Action

Specify a single-character code. Valid actions are:

  • "A" ( add)

  • "U" (update)

  • "L" (update/display all)

  • "C" (correction)

  • "E" (data entry)

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

Keylist

An optional list of field specifications used to select a unique row at level zero in the page you are transferring to, by matching keys in the page you are transferring from. It can also be an already instantiated record object.

If a record object is specified, any field of that record object that is also a field of the search record for the destination component is added to keylist. The keys in the fieldlist must uniquely identify a row in the "to" page search record. If a unique row is not identified, of if Force Search Processing has been selected, the search dialog appears.

If the keylist parameter is not supplied the destination component's search key must be found as part of the source components level 0 record buffer.

Returns

If the node has a Node Type of PIA, a string of the following format is returned:

../../../Portal/node/c/menu.component.market?parameters

If the node has a Node Type of ICType, a string of the following format is returned:

../../../portal/node/?ICType=Panel&Menu=menu&Market=market&PanelGroupName=component?parameters

The question mark and the text following the question mark may or may not be included, depending on whether or not you specified a page and action or not.

This function returns a Null string if you specify an invalid portal or node.

Example

The following code:

&MyCompURL = GenerateComponentContentRelURL("EMPLOYEEPORTAL", "CRM", MenuName.SFA, "GBL", Component.CUSTOMERINFO, Page.CUST_DATA1, "U", EMPLID);

Might create the following URL:

../../../psc/PS84/EMPLOYEEPORTAL/CRM/c/SFA.CUSTOMERINFO.GBL?page=CUST_DATA1&&Action=U&emplid=00001

Because this function terminates if the portal or node name is invalid, it's enclosed in a try-catch section so if an exception gets raised, it can be handled.

try &MyURL = GenerateComponentContentRelURL(%Portal, "HRMS", Menuname.ADMIN_WORKFORCE, "GBL", Component.ABSENCE_HISTORY, Page. ABSENCE_HISTORY, "U", EMPLID) catch ExceptionPortal &Ex1 /* error handling portal name not valid */ catch ExceptionNode &Ex2 /* error handling Node name not valid */ end-try;

See Also

GenerateComponentContentURL, GenerateComponentPortalRelURL, GenerateComponentPortalURL, GenerateComponentRelativeURL.

Internet Script Classes (iScript)

Click to jump to top of pageClick to jump to parent topicGenerateComponentContentURL

Syntax

GenerateComponentContentURL(PORTAL.portalname, NODE.nodename, MENUNAME.menuname, MARKET.marketname, COMPONENT.componentname, PAGE.pagename, action, [, keylist])

where keylist is a list of field references in the form:

[recordname.]field1 [, [recordname.]field2]. . .

OR

&RecordObject1 [, &RecordObject2]. . .

Description

Use the GenerateComponentContentURL function to create a URL string that represents an absolute reference to the specified component for the content servlet.

The ContentURI of the specified node is used in the generated URL. The URL contains a reference to the portal content (psc) servlet. If you want to generate a URL for the portal service (psp), use the GenerateComponentPortalURL function.

Parameters

PortalName

Specify the name of the portal used for this request, prefixed with the reserved word PORTAL. You can also use a string, such as %Portal, for this value. This parameter is ignored by the content service, but is a required part of the psc URL format.

NodeName

Specify the name of the node that contains the content, prefixed with the reserved word NODE. You can also use a string, such as %Node, for this value.

MenuName

Specify the name of the menu containing the content, prefixed with the reserved word MENUNAME. You can also use a string, such as %Menu, for this value.

Marketname

Specify the name of the market of the component, prefixed with the reserved word MARKET. You can also use a string, such as %Market, for this value.

ComponentName

Specify the name of the component, prefixed with the reserved word COMPONENT. You can also use a string, such as %Component, for this value.

Pagename

Specify the name of the page that contains the content. If you specify a page name, it must be prefixed with the keyword PAGE. You can also specify an empty string ("") for this value.

Action

Specify a single-character code. Valid actions are:

  • "A" ( add)

  • "U" (update)

  • "L" (update/display all)

  • "C" (correction)

  • "E" (data entry)

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

Keylist

An optional list of field specifications used to select a unique row at level zero in the page you are transferring to, by matching keys in the page you are transferring from. It can also be an already instantiated record object.

If a record object is specified, any field of that record object that is also a field of the search record for the destination component is added to keylist. The keys in the fieldlist must uniquely identify a row in the "to" page search record. If a unique row is not identified, of if Force Search Processing has been selected, the search dialog appears.

If the keylist parameter is not supplied the destination component's search key must be found as part of the source components level 0 record buffer.

Returns

If the node has a Node Type of PIA, a string of the following format is returned:

http://Content URI of host node/Portal/node/c/menu.component.market?parameters

If the node has a Node Type of ICType, a string of the following format is returned:

http://Content URI of host node/portal/node/?ICType=Panel&Menu=menu&Market=market&PanelGroupName=component?parameters

The question mark and the text following the question mark may or may not be included, depending on whether or not you specified a page and action or not.

This function returns a Null string if you specify an invalid portal or node.

Example

The following code:

&MyCompURL = GenerateComponentContentURL("EMPLOYEEPORTAL", "CRM", MenuName.SFA, "GBL", Component.CUSTOMERINFO, Page.CUST_DATA1, "U", EMPLID);

Might create the following URL:

http://serverx/servlets/psc/PS84/EMPLOYEEPORTAL/CRM/c/SFA.CUSTOMERINFO.GBL?page=CUST_DATA1&&Action=U&emplid=00001

Because this function terminates if the portal or node name is invalid, it's enclosed in a try-catch section so if an exception gets raised, it can be handled.

try &MyURL = GenerateComponentContentURL(%Portal, "HRMS", Menuname.ADMIN_WORKFORCE, "GBL", Component.ABSENCE_HISTORY, Page. ABSENCE_HISTORY, "U", EMPLID) catch ExceptionPortal &Ex1 /* error handling portal name not valid */ catch ExceptionNode &Ex2 /* error handling Node name not valid */ end-try;

See Also

GenerateComponentContentRelURL, GenerateComponentPortalRelURL, GenerateComponentPortalURL, GenerateComponentRelativeURL.

Internet Script Classes (iScript)

Click to jump to top of pageClick to jump to parent topicGenerateComponentPortalRelURL

Syntax

GenerateComponentPortalRelURL(PORTAL.portalname, NODE.nodename, MENUNAME.menuname, MARKET.marketname, COMPONENT.componentname, PAGE.pagename, action, [, keylist])

where keylist is a list of field references in the form:

[recordname.]field1 [, [recordname.]field2]. . .

OR

&RecordObject1 [, &RecordObject2]. . .

Description

Use the GenerateComponentPortalRelURL function to create a URL string URL string that represents a relative reference the specified content (component). The relative reference is suitable for use on any page that itself has the simple URL format.

If you want to generate an absolute URL for a component, use the GenerateComponentPortalURL function.

Parameters

portalname

Specify the name of the portal used for this request, prefixed with the reserved word PORTAL. You can also use a string, such as %Portal, for this value.

nodename

Specify the name of the node that contains the content, prefixed with the reserved word NODE. You can also use a string, such as %Node, for this value.

menuname

Specify the name of the menu containing the content, prefixed with the reserved word MENUNAME. You can also use a string, such as %Menu, for this value.

Marketname

Specify the name of the market of the component, prefixed with the reserved word MARKET. You can also use a string, such as %Market, for this value.

ComponentName

Specify the name of the component, prefixed with the reserved word COMPONENT. You can also use a string, such as %Component, for this value.

pagename

Specify the name of the page that contains the content. If you specify a page name, it must be prefixed with the keyword PAGE. You can also specify a Null string ("") for this value.

action

Specify a single-character code. Valid actions are:

  • "A" ( add)

  • "U" (update)

  • "L" (update/display all)

  • "C" (correction)

  • "E" (data entry)

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

keylist

An optional list of field specifications used to select a unique row at level zero in the page you are transferring to, by matching keys in the page you are transferring from. It can also be an already instantiated record object.

If a record object is specified, any field of that record object that is also a field of the search record for the destination component is added to keylist. The keys in the fieldlist must uniquely identify a row in the "to" page search record. If a unique row is not identified, of if Force Search Processing has been selected, the search dialog appears.

If the keylist parameter is not supplied the destination component's search key must be found as part of the source components level 0 record buffer.

Returns

If the node has a Node Type of PIA, a string of the following format is returned:

../../../portal/node/c/menu.component.market?parameters

If the node has a Node Type of ICType, a string of the following format is returned:

../../../portal/node/?ICType=Panel&Menu=menu&Market=market&PanelGroupName=component?parameters

The question mark and the text following the question mark may or may not be included, depending on whether or not you specified a page and action or not.

This function returns a Null string if you specify an invalid portal or node.

Example

The following code:

&MyCompURL = GenerateComponentPortalRelURL("EMPLOYEEPORTAL", "CRM", MenuName.SFA, "GBL", Component.CUSTOMERINFO, , "", "");

Might create the following URL:

../../../EMPLOYEEPORTAL/CRM/c/sfa.customerinfo.gbl

See Also

GenerateComponentContentRelURL, GenerateComponentContentURL, GenerateComponentPortalURL, GenerateComponentRelativeURL, Internet Script Classes (iScript).

Click to jump to top of pageClick to jump to parent topicGenerateComponentPortalURL

Syntax

GenerateComponentPortalURL(PORTAL.portalname, NODE.nodename, MENUNAME.menuname, MARKET.marketname, COMPONENT.componentname, PAGE.pagename, action, [, keylist])

where keylist is a list of field references in the form:

[recordname.]field1 [, [recordname.]field2]. . .

OR

&RecordObject1 [, &RecordObject2]. . .

Description

Use the GenerateComponentPortalURL function to create a URL string that represents an absolute reference to the specified component for the portal servlet. The PortalURI of the node that hosts the specified portal is used in the generated URL. The URL contains a reference to the portal service (psp) servlet.

If you want to generate a URL for the portal content (psc) servlet, use the GenerateComponentContentURL function.

Parameters

portalname

Specify the name of the portal used for this request, prefixed with the reserved word PORTAL. You can also use a string, such as %Portal, for this value.

nodename

Specify the name of the node that contains the content, prefixed with the reserved word NODE. You can also use a string, such as %Node, for this value.

menuname

Specify the name of the menu containing the content, prefixed with the reserved word MENUNAME. You can also use a string, such as %Menu, for this value.

Marketname

Specify the name of the market of the component, prefixed with the reserved word MARKET. You can also use a string, such as %Market, for this value.

ComponentName

Specify the name of the component, prefixed with the reserved word COMPONENT. You can also use a string, such as %Component, for this value.

pagename

Specify the name of the page that contains the content. If you specify a page name, it must be prefixed with the keyword PAGE. You can also specify a Null string ("") for this value.

action

Specify a single-character code. Valid actions are:

  • "A" ( add)

  • "U" (update)

  • "L" (update/display all)

  • "C" (correction)

  • "E" (data entry)

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

keylist

An optional list of field specifications used to select a unique row at level zero in the page you are transferring to, by matching keys in the page you are transferring from. It can also be an already instantiated record object.

If a record object is specified, any field of that record object that is also a field of the search record for the destination component is added to keylist. The keys in the fieldlist must uniquely identify a row in the "to" page search record. If a unique row is not identified, of if Force Search Processing has been selected, the search dialog appears.

If the keylist parameter is not supplied the destination component's search key must be found as part of the source components level 0 record buffer.

Returns

If the node has a Node Type of PIA, a string of the following format is returned:

http://Portal URI of host node/portal/node/c/menu.component.market?parameters

If the node has a Node Type of ICType, a string of the following format is returned:

http://Portal URI of host node/portal/node/?ICType=Panel&Menu=menu&Market=market&PanelGroupName=component?parameters

Note. If the host node is local, then Portal URI of host node will always be the one you're currently logged in as.

The question mark and the text following the question mark may or may not be included, depending on whether or not you specified a page and action or not.

This function returns a Null string if you specify an invalid portal or node.

Example

The following code:

&MyCompURL = GenerateComponentPortalURL("EMPLOYEEPORTAL", "CRM", MenuName.SFA, "GBL", Component.CUSTOMERINFO, , "", "");

Might create the following URL:

http://mike.com/servlets/psp/testsite/EMPLOYEEPORTAL/CRM/c/sfa.customerinfo.gbl

The following example uses a de-referenced name for the component.

&sComponent = "Component." | &sComponent; &sPage = "Page.EM_VCHR_PYMNT_CLN"; &rwCurrent = GetRow(); /*- The Search Record keys -*/ &sQueryString = &sQueryString | "&BUSINESS_UNIT=" | &rwCurrent.EM_VCHR_INQ_VW.EM_BUSINESS_UNIT.Value; &sQueryString = &sQueryString | "&VOUCHER_ID=" | &rwCurrent.EM_VCHR_INQ_VW.VOUCHER_ID.Value; &sQueryString = GenerateComponentPortalURL(%Portal, %Node, MenuName.EM_BILL_PRESENTMENT, %Market, @&sComponent, @&sPage, "U") | &sQueryString; %Response.RedirectURL(&sURL);

See Also

GenerateComponentContentRelURL, GenerateComponentContentURL, GenerateComponentPortalRelURL, GenerateComponentRelativeURL.

Internet Script Classes (iScript)

Click to jump to top of pageClick to jump to parent topicGenerateComponentRelativeURL

Syntax

GenerateComponentRelativeURL(PORTAL.portalname, NODE.nodename, MENUNAME.menuname, MARKET.marketname, COMPONENT.componentname, PAGE.pagename, action, [, keylist])

where keylist is a list of field references in the form:

[recordname.]field1 [, [recordname.]field2]. . .

OR

&RecordObject1 [, &RecordObject2]. . .

Description

Use the GenerateComponentRelativeURL function to create a URL string that represents a relative reference the specified content (component). The relative reference is suitable for use on any page that itself has the simple URL format.

If you want to generate an absolute URL for a component, use either the GenerateComponentContentURL or GenerateComponentPortalURL function.

Parameters

portalname

Specify the name of the portal used for this request, prefixed with the reserved word PORTAL. You can also use a string, such as %Portal, for this value.

nodename

Specify the name of the node that contains the content, prefixed with the reserved word NODE. You can also use a string, such as %Node, for this value.

menuname

Specify the name of the menu containing the content, prefixed with the reserved word MENUNAME. You can also use a string, such as %Menu, for this value.

Marketname

Specify the name of the market of the component, prefixed with the reserved word MARKET. You can also use a string, such as %Market, for this value.

ComponentName

Specify the name of the component, prefixed with the reserved word COMPONENT. You can also use a string, such as %Component, for this value.

Pagename

Specify the name of the page that contains the content. If you specify a page name, it must be prefixed with the keyword PAGE. You can also specify a Null string ("") for this value.

Action

Specify a single-character code. Valid actions are:

  • "A" ( add)

  • "U" (update)

  • "L" (update/display all)

  • "C" (correction)

  • "E" (data entry)

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

Keylist

An optional list of field specifications used to select a unique row at level zero in the page you are transferring to, by matching keys in the page you are transferring from. It can also be an already instantiated record object.

If a record object is specified, any field of that record object that is also a field of the search record for the destination component is added to keylist. The keys in the fieldlist must uniquely identify a row in the "to" page search record. If a unique row is not identified, of if Force Search Processing has been selected, the search dialog appears.

If the keylist parameter is not supplied the destination component's search key must be found as part of the source components level 0 record buffer.

Returns

If the node has a Node Type of PIA, a string of the following format is returned:

../../../portal/node/c/menu.component.market?parameters

If the node has a Node Type of ICType, a string of the following format is returned:

../../../portal/node/?ICType=Panel&Menu=menu&Market=market&PanelGroupName=component?parameters

The question mark and the text following the question mark may or may not be included, depending on whether or not you specified a page and action or not.

This function returns a Null string if you specify an invalid portal or node.

Example

The following code example:

&MyCompURL = GenerateComponentRelativeURL("EMPLOYEEPORTAL", "CRM", MenuName.SFA, "GBL", Component.CUSTOMERINFO, "", "");

Might yield the following:

../../../EMPLOYEEPORTAL/CRM/c/sfa.customerinfo.gbl

See Also

GenerateComponentContentRelURL, GenerateComponentContentURL, GenerateComponentPortalRelURL, GenerateComponentPortalURL.

Internet Script Classes (iScript)

Click to jump to top of pageClick to jump to parent topicGenerateExternalPortalURL

Syntax

GenerateExternalPortalURL(PORTAL.portalname, NODE.nodename, URL)

Description

Use the GenerateExternalPortalURL function to create a URL string that represents an absolute reference the specified external content (URL) on the portal servlet.

The PortalURI of the node that hosts the specified portal is used in the generated URL. The generated URL contains a reference to the portal service (psp) servlet.

If you want to generate a relative URL, use the GenerateExternalRelativeURL function.

Parameters

portalname

Specify the name of the portal used for this request, prefixed with the reserved word PORTAL. You can also use a string, such as %Portal, for this value.

NodeName

Specify the name of the node that contains the content, prefixed with the reserved word NODE. You can also use a string, such as %Node, for this value.

URL

Specify the URL to be used for this content.

Returns

A string of the following format is returned:

http://Portal URI of host node/Portal/node/e/encodedURL

When the portal servlet evaluates an external URL, the Node is ignored, so %Node can always be passed in for the Node parameter.

This function returns a Null string if you specify an invalid portal or node.

Example

The following code:

&url = GenerateExternalPortalURL("EMPLOYEEPORTAL", "CRM", "http://www.excite.com");

Might create the following URL:

http://myserver/psp/ps/EMPLOYEEPORTAL/CRM/e/http%3a%2f%2fwww.excite.com

See Also

GenerateExternalRelativeURL.

Internet Script Classes (iScript)

Click to jump to top of pageClick to jump to parent topicGenerateExternalRelativeURL

Syntax

GenerateExternalRelativeURL(PORTAL.portalname, NODE.nodename, EncodedURL)

Description

Use the GenerateExternalRelativeURL function to create a URL string that represents a relative reference the specified external content (URL). The relative reference is suitable for use on any page that itself has the simple URL format and which is served by the portal servlet (psp).

If you want to generate an absolute URL, use the GenerateExternalPortalURL function.

Parameters

PortalName

Specify the name of the portal used for this request, prefixed with the reserved word PORTAL. You can also use a string, such as %Portal, for this value.

NodeName

Specify the name of the node that contains the content, prefixed with the reserved word NODE. You can also use a string, such as %Node, for this value.

EncodedURL

Specify the URL to be used for this content.

Returns

A string of the following format is returned:

../../../Portal/node/e/encodedURL

This function returns a Null string if you specify an invalid portal or node.

Example

The following code:

&url = GenerateExternalRelativeURL("EMPLOYEEPORTAL", "CRM", "http://www.excite.com");

Might create the following URL:

../../../EMPLOYEEPORTAL/CRM/e/http%3a%2f%2fwww.excite.com

See Also

GenerateExternalRelativeURL.

Internet Script Classes (iScript)

Click to jump to top of pageClick to jump to parent topicGenerateHomepagePortalURL

Syntax

GenerateHomepagePortalURL(PORTAL.portalname, NODE.nodename, Tabname)

Description

Use the GenerateHomepagePortalURL function to create a URL string that represents an absolute reference the specified homepage tab on the portal servlet.

The PortalURI of the node that hosts the specified portal is used in the generated URL. The generated URL contains a reference to the portal service (psp) servlet.

If you want to generate a relative URL, use the GenerateHomepageRelativeURL function.

Parameters

portalname

Specify the name of the portal used for this request, prefixed with the reserved word PORTAL. You can also use a string, such as %Portal, for this value.

Note. The value specified for this parameter is ignored. The node name that is used is automatically calculated. However, you must still specify a value for this parameter.

nodename

Specify the name of the node that contains the content, prefixed with the reserved word NODE. You can also use a string, such as %Node, for this value. This should be the node that hosts the specified portal.

Tabname

Specify the name of the tab on the homepage that you want to generate a URL for. If you specify a null string (""), the default tab is used.

Returns

If the node has a Node Type of PIA, a string of the following format is returned:

http://Portal URI of host node/Portal/node/h/?tab=tabname

This function returns a Null string if you specify an invalid portal or node.

Example

Specifying the following code:

&HomePage = GenerateHomepagePortalURL(%Portal, NODE.North_Asia, "");

Might generate the following string:

http://bejing/psp/psoft/crm/North_Asia/h/?tab=DEFAULT

See Also

GenerateHomepageRelativeURL.

PortalRegistry Classes

Internet Script Classes (iScript)

Click to jump to top of pageClick to jump to parent topicGenerateHomepageRelativeURL

Syntax

GenerateHomepageRelativeURL(PORTAL.portalname, NODE.nodename, Tabname)

Description

Use the GenerateHomepageRelativeURL function to create a URL string that represents a relative reference the specified homepage on the portal servlet. The relative reference is suitable for use on any page that itself has the simple URL format.

If you want to generate an absolute URL, use the GenerateHomepagePortalURL function.

Parameters

portalname

Specify the name of the portal used for this request, prefixed with the reserved word PORTAL. You can also use a string, such as %Portal, for this value.

nodename

Specify the name of the node that contains the content, prefixed with the reserved word NODE. You can also use a string, such as %Node, for this value. . This should be the node that hosts the specified portal.

Tabname

Specify the name of the tab on the homepage that you want to generate a URL for. If you specify a null string (""), the default tab is used.

Returns

If the node has a Node Type of PIA, a string of the following format is returned:

../../../Portal/node/h/?tab=tabname

If the node has a Node Type of ICType, a string of the following format is returned:

./?cmd=start

This function returns a Null string if you specify an invalid portal or node.

Example

The following code:

&HomePage = GenerateHomepageRelativeURL(%Portal, NODE.North_Asia, "");

Might generate the following string:

../../../crm/North_Asia/h/?tab=DEFAULT

See Also

GenerateHomepagePortalURL.

PortalRegistry Classes

Internet Script Classes (iScript)

Click to jump to top of pageClick to jump to parent topicGenerateMobileTree

Syntax

GenerateMobileTree(&CIObject [,CIObject_property])

Description

Use the GenerateMobileTree function to display data in a tree format, with nodes and leaves. The result of the GenerateMobileTree function is an HTML string, which can be displayed in an HTML area control.

Use this function in the OnInit event to display the mobile tree, and on the OnChange event for programs related to expanding, collapsing or selecting nodes.

Mobile HTML Tree

The positional links at the top of the page (First, Previous, Next, Last, Left, Right) enable the user to navigate around the tree. These links are automatically generated as part of the execution of GenerateTree.

The icon next to a node can have a + sign or a - sign in it, depending on whether the node is collapsed or expanded. When a node is collapsed, none of the nodes that report to the collapsed node are displayed, and the icon has a + sign. When a node is expanded, all the nodes that report to it are displayed, and the icon has a - sign. You can collapse and expand a node by clicking in the icon. This enables you to view the tree at different levels of detail. When the icon for a node has no + or − sign in it, it is a terminal node, and cannot be expanded or collapsed.

Using the GenerateMobileTree Function

The GenerateMobileTree function is similar to the GenerateTree function, however, there are several important differences.

To use the GenerateMobileTree function:

  1. Define the Component Interface.

    You must use a Component Interface that is created from a component that contains the TREECTL_HDR and TREECTL_NODE records. When the Component Interface is synched to the device, these records do not have to contain any data, they can be populated using PeopleCode.

    See Using HTML Tree Rowset Records.

  2. Add an HTML area to the mobile page.

    This involves adding a long text field to the Component Interface, specifying how it displays on the mobile page, and so on. The value of the Component Interface long text field is what is displayed in the HTML area.

    See Setting Mobile Page Content Properties.

  3. Determine what property on the Component Interface is going to contain the OnChange PeopleCode used to evaluate the end user action and call the appropriate PeopleCode programs.

    The action an end user takes (selecting a row, or expanding or collapsing a node) is accessible to this property.

    This property must be a character field that is at least 46 characters long. The field can be made invisible.

  4. Specify this property as the value for the PAGE_FIELD_NAME field on the TREECTRL_HDR_SBR record.

  5. Populate the tree, specify values for the nodes, leaves, images, and so on.

Parameters

&CIObject

This is the mobile object that is to be viewed in a hierarchy tree view. This object is from a peer reference.

CIObject_property

This is a property on the mobile object that is to be viewed in a hierarchy tree view.

Returns

None.

Example

In the OnInit event, generate the mobile tree.

Local ApiObject &ob; &ob = %ThisMobileObject; &MyCI = %Session.GetCompIntfc(ComIntfc.RDM_RELTREE); &MyCI.Key_01 = "2"; &MyCI.Create(); &MyCI.PAGE_FIELD_NAME = "TREELEVELNT"; &MyCI.RDM.RELTREE_NDE.InsertItem(1); &MyCI.RDM.RELTREE_NDE.Item(1).TREE_NODE = "NAME 1"; &MyCI.RDM.RELTREE_NDE.Item(1).DESCR = "Descr 1"; &MyCI.RDM.RELTREE_NDE.Item(1).PARENT_FLAG = "Y"; &MyCI.RDM.RELTREE_NDE.Item(1).TREE_LEVEL_NUM = 1; &MyCI.RDM.RELTREE_NDE.Item(1).LEAF_FLAG = "N"; &MyCI.RDM.RELTREE_NDE.InsertItem(2); &MyCI.RDM.RELTREE_NDE.Item(2).TREE_NODE = "NAME 3"; &MyCI.RDM.RELTREE_NDE.Item(2).DESCR = "Descr 2"; &MyCI.RDM.RELTREE_NDE.Item(2).PARENT_FLAG = "Y"; &MyCI.RDM.RELTREE_NDE.Item(2).TREE_LEVEL_NUM = 2; &MyCI.RDM.RELTREE_NDE.Item(2).LEAF_FLAG = "N"; &MyCI.RDM.RELTREE_NDE.InsertItem(3); &MyCI.RDM.RELTREE_NDE.Item(3).TREE_NODE = "NAME 1"; &MyCI.RDM.RELTREE_NDE.Item(3).DESCR = "Descr 3"; &MyCI.RDM.RELTREE_NDE.Item(3).PARENT_FLAG = "Y"; &MyCI.RDM.RELTREE_NDE.Item(3).TREE_LEVEL_NUM = 1; &MyCI.RDM.RELTREE_NDE.Item(3).LEAF_FLAG = "N"; &OB.QE_COMMENTS = GenerateMobileTree(&MyCI);

The following PeopleCode is used in the OnChange event (used for when a user selects a node, expands a node or closes a node):

Local ApiObject &ob; &ob = %ThisMobileObject; &MyCI = %Session.GetCompIntfc(ComIntfc.RDM_RELTREE); &MyCI.Key_01 = "2"; &MyCI.Get(); &MyCI.PAGE_FIELD_NAME = "TREECTLEVENT" If Left(%ThisMobileObject.TREELEVENT, 1) = "S" Then Warning ("This node has been selected"); End-If; &ob.QE_COMMENTS = GenerateMobileTree(&MyCI, %ThisMobileObject.TREELEVENT);

See Also

GenerateTree.

Click to jump to top of pageClick to jump to parent topicGenerateQueryContentURL

Syntax

GenerateQueryContentURL(PORTAL.portalname, NODE.nodename, QueryName, IsPublic [, IsNewWindow])

Description

Use the GenerateQueryContentURL function to create a URL string that represents an absolute reference the specified query (URL) on the content servlet.

The PortalURI of the node that hosts the specified portal is used in the generated URL. The generated URL contains a reference to the portal content (psc) servlet.

If you want to generate a relative URL, use the GenerateQueryRelativeURL function.

If you want to generate a URL for the portal service (psp) servlet, use the GenerateQueryPortalURL function.

Parameters

portalname

Specify the name of the portal used for this request, prefixed with the reserved word PORTAL. You can also use a string, such as %Portal, for this value.

nodename

Specify the name of the node that contains the query, prefixed with the reserved word NODE. You can also use a string, such as %Node, for this value.

Queryname

Specify the name of the query you want to generate a URL for. This parameter takes a string value.

IsPublic

Specify whether the query is public or private. This parameter takes a Boolean value: True, the query is public, False otherwise.

IsNewWindow

Specify whether the URL is for a new browser instance. This parameter takes a Boolean value: True, the URL is for a new browser instance, False otherwise. The default is False.

If the value is True this function generates a new state block for use in a separate browser instance. This does not automatically open a new browser instance. It just supports it.

Note. When Query is being run on a PeopleTools version prior to 8.16, the query URL does not include the ability to specify if a query is public or private. On PeopleTools versions 8.16 and higher, the generated URL contains either the keyword PUBLIC or PRIVATE prepended to the query name. If you are building a URL for a portal node that is on a PeopleTools release prior to 8.16, you must remove the public or private keyword before trying to use the URL.

Returns

If IsPublic is specified as True, and the node has a Node Type of PIA, a string of the following format is returned:

http://PortalURI/Portal/node/q/?ICAction=ICQryNameURL=PUBLIC.QueryName

If IsPublic is specified as False, and the node has a Node Type of PIA, a string of the following format is returned:

http://PortalURI/Portal/node/q/?ICAction=ICQryNameURL=PRIVATE.QueryName

This function returns a Null string if you specify an invalid portal or node.

Example

The following code example:

&url = GenerateQueryContentURL(%Portal, "RMTNODE", "QUERYNAME", True);

might produce a string as follows:

http://bsto091200/psc/ps/EMPLOYEE/RMTNODE/q/?ICAction=ICQryNameURL=PUBLIC.QUERYNAME

The following code example uses the optional parameter to produce a URL that supports a new browser instance:

&url = GenerateQueryContentURL(%Portal, "RMTNODE", "QUERYNAME", True, True);

might produce a string as follows:

http://bsto091200/psc/ps_newwin/EMPLOYEE/RMTNODE/q/?ICAction=ICQryNameURL=PUBLIC.QUERYNAME

See Also

GenerateQueryPortalURL, GenerateQueryRelativeURL.

Internet Script Classes (iScript)

Query Classes

Getting Started with PeopleSoft Query

Click to jump to top of pageClick to jump to parent topicGenerateQueryPortalURL

Syntax

GenerateQueryPortalURL(PORTAL.portalname, NODE.nodename, QueryName, IsPublic [, IsNewWindow])

Description

Use the GenerateQueryPortalURL function to create a URL string that represents an absolute reference the specified query (URL) on the portal servlet.

The PortalURI of the node that hosts the specified portal is used in the generated URL. The generated URL contains a reference to the portal service (psp) servlet.

If you want to generate a relative URL, use the GenerateQueryRelativeURL function.

If you want to generate a URL for the portal content (psc) servlet, use the GenerateQueryContentURL function.

Parameters

portalname

Specify the name of the portal used for this request, prefixed with the reserved word PORTAL. You can also use a string, such as %Portal, for this value.

nodename

Specify the name of the node that contains the query, prefixed with the reserved word NODE. You can also use a string, such as %Node, for this value.

Queryname

Specify the name of the query you want to generate a URL for. This parameter takes a string value.

IsPublic

Specify whether the query is public or private. This parameter takes a Boolean value: True, the query is public, False otherwise.

IsNewWindow

Specify whether the URL is for a new browser instance. This parameter takes a Boolean value: True, the URL is for a new browser instance, False otherwise. The default is False.

If the value is True this function generates a new state block for use in a separate browser instance. This does not automatically open a new browser instance. It just supports it.

Note. When Query is being run on a PeopleTools version prior to 8.16, the query URL does not include the ability to specify if a query is public or private. On PeopleTools versions 8.16 and higher, the generated URL contains either the keyword PUBLIC or PRIVATE prepended to the query name. If you are building a URL for a portal node that is on a PeopleTools release prior to 8.16, you must remove the public or private keyword before trying to use the URL.

Returns

If IsPublic is specified as True, and the node has a Node Type of PIA, a string of the following format is returned:

http://PortalURI/Portal/node/q/?ICAction=ICQryNameURL=PUBLIC.QueryName

If IsPublic is specified as False, and the node has a Node Type of PIA, a string of the following format is returned:

http://PortalURI/Portal/node/q/?ICAction=ICQryNameURL=PRIVATE.QueryName

This function returns a Null string if you specify an invalid portal or node.

Example

The following code example:

&url = GenerateQueryPortalURL(%Portal, "RMTNODE", "QUERYNAME", True);

might produce a string as follows:

http://bsto091200/psp/ps/EMPLOYEE/RMTNODE/q/?ICAction=ICQryNameURL=PUBLIC.QUERYNAME

The following code example uses the optional parameter to produce a URL that supports a new browser instance:

&url = GenerateQueryPortalURL(%Portal, "RMTNODE", "QUERYNAME", True, True);

might produce a string as follows:

http://bsto091200/psp/ps_newwin/EMPLOYEE/RMTNODE/q/?ICAction=ICQryNameURL=PUBLIC.QUERYNAME

See Also

GenerateQueryContentURL, GenerateQueryRelativeURL.

Internet Script Classes (iScript)

Query Classes

Getting Started with PeopleSoft Query

Click to jump to top of pageClick to jump to parent topicGenerateQueryRelativeURL

Syntax

GenerateQueryRelativeURL(PORTAL.portalname, NODE.nodename, QueryName, IsPublic [, IsNewWindow])

Description

Use the GenerateQueryRelativeURL function to creates a URL string that represents a relative reference to the specified query on the portal servlet. The relative reference is suitable for use on any page that itself has the simple URL format.

If you want to generate an absolute URL, use either the GenerateQueryPortalURL or GenerateQueryContentURL function.

Parameters

portalname

Specify the name of the portal used for this request, prefixed with the reserved word PORTAL. You can also use a string, such as %Portal, for this value.

nodename

Specify the name of the node that contains the query, prefixed with the reserved word NODE. You can also use a string, such as %Node, for this value.

Queryname

Specify the name of the query you want to generate a URL for. This parameter takes a string value.

IsPublic

Specify whether the query is public or private. This parameter takes a Boolean value: True, the query is public, False otherwise.

IsNewWindow

Specify whether the URL is for a new browser instance. This parameter takes a Boolean value: True, the URL is for a new browser instance, False otherwise. The default is False.

If the value is True this function generates a new state block for use in a separate browser instance. This does not automatically open a new browser instance. It just supports it.

Note. When Query is being run on a PeopleTools version prior to 8.16, the query URL does not include the ability to specify if a query is public or private. On PeopleTools versions 8.16 and higher, the generated URL contains either the keyword PUBLIC or PRIVATE prepended to the query name. If you are building a URL for a portal node that is on a PeopleTools release prior to 8.16, you must remove the public or private keyword before trying to use the URL.

Returns

If IsPublic is specified as True, and the node has a Node Type of PIA, a string of the following format is returned:

../../../portal/node/q/?ICAction=ICQryNameURL=PUBLIC.QueryName

If IsPublic is specified as False, and the node has a Node Type of PIA, a string of the following format is returned:

../../../portal/node/q/q/?ICAction=ICQryNameURL=PRIVATE.QueryName

This function returns a Null string if you specify an invalid portal or node.

Example

The following code example:

&url = GenerateQueryRelativeURL(%Portal, "RMTNODE", "QUERYNAME", True);

might produce a string as follows:

../../../EMPLOYEE/RMTNODE/q/?ICAction=ICQryNameURL=PUBLIC.QUERYNAME

See Also

GenerateQueryContentURL, GenerateQueryPortalURL.

Internet Script Classes (iScript)

Query Classes

Getting Started with PeopleSoft Query

Click to jump to top of pageClick to jump to parent topicGenerateScriptContentRelURL

Syntax

GenerateScriptContentRelURL(PORTAL.portalname, NODE.nodename, RECORD.recordname, FIELD.fieldname, event_name, function_name, [, keylist])

where keylist is a list of field references in the form:

[recordname.]field1 [, [recordname.]field2]. . .

OR

&RecordObject1 [, &RecordObject2]. . .

Description

Use the GenerateScriptContentRelURL function to create a URL string that represents a relative reference to the specified iScript. The generated URL contains a reference to the portal content (psc) servlet.

If you want to generate an absolute URL for an iScript for the portal content servlet, use the GenerateScriptContentURL function.

Parameters

portalname

Specify the name of the portal used for this request, prefixed with the reserved word PORTAL. You can also use a string, such as %Portal, for this value.

nodename

Specify the name of the node that contains the iScript, prefixed with the reserved word NODE. You can also use a string, such as %Node, for this value.

recordname

Specify the name of the record containing the iScript, prefixed with the reserved word RECORD.

fieldname

Specify the name of the field containing the iScript, prefixed with the reserved word FIELD.

event_name

Specify the name of the event containing the iScript. This is generally the FieldFormula event.

function_name

Specify the name of the iScript function.

keylist

An optional list of parameters used with the function. It can also be an already instantiated record object.

Returns

If the node has a Node Type of PIA, a string of the following format is returned:

/psc/s/recname.fieldname.event_name.function_name?parameters

If the node has a Node Type of ICType, a string of the following format is returned:

/portal/node/?ICType=Script&ICScriptProgramName=recname.fieldname.event_name.function_name?parameters

The question mark and the text following the question mark may or may not be included, depending on whether or not you specified a page and action or not.

This function returns a Null string if you specify an invalid portal or node.

Example

The following code:

&MyScriptURL = GenerateScriptContentRelURL("EMPLOYEEPORTAL", "CRM", Record.WEBLIB_CRM, Field.SFASCRIPTS, "FieldFormula", "Iscript_SFAHOME ");

Might yield the following URL:

/psc/s/WEBLIB_CRM.SFASCRIPTS.FieldFormula.IScript_SFAHOME

See Also

GenerateScriptContentURL, GenerateScriptPortalRelURL, GenerateScriptPortalURL, GenerateScriptRelativeURL.

Internet Script Classes (iScript)

Click to jump to top of pageClick to jump to parent topicGenerateScriptContentURL

Syntax

GenerateScriptContentURL(PORTAL.portalname, NODE.nodename, RECORD.recordname, FIELD.fieldname, event_name, function_name, [, keylist])

where keylist is a list of field references in the form:

[recordname.]field1 [, [recordname.]field2]. . .

OR

&RecordObject1 [, &RecordObject2]. . .

Description

Use the GenerateScriptContentURL function to create a URL string that represents an absolute reference to the specified iScript for the content servlet.

The ContentURI of the specified node is used in the generated URL. The URL contains a reference to the portal content (psc) servlet.

If you want to generate a URL for an iScript for the portal servlet, use the GenerateScriptPortalURL function.

Parameters

portalname

Specify the name of the portal used for this request, prefixed with the reserved word PORTAL. You can also use a string, such as %Portal, for this value.

nodename

Specify the name of the node that contains the iScript, prefixed with the reserved word NODE. You can also use a string, such as %Node, for this value.

recordname

Specify the name of the record containing the iScript, prefixed with the reserved word RECORD.

fieldname

Specify the name of the field containing the iScript, prefixed with the reserved word FIELD.

event_name

Specify the name of the event containing the iScript. This is generally the FieldFormula event.

function_name

Specify the name of the iScript function.

keylist

An optional list of parameters used with the function. It can also be an already instantiated record object.

Returns

If the node has a Node Type of PIA, a string of the following format is returned:

http://Content URI of host node/portal/node/s/recname.fieldname.event_name.function_name?parameters

If the node has a Node Type of ICType, a string of the following format is returned:

http://Content URI of host node/portal/node/?ICType=Script&ICScriptProgramName=recname.fieldname.event_name.function_name?parameters

The question mark and the text following the question mark may or may not be included, depending on whether or not you specified a page and action or not.

This function returns a Null string if you specify an invalid portal or node.

Example

The following code:

&MyScriptURL = GenerateScriptContentURL("EMPLOYEEPORTAL", "CRM", Record.WEBLIB_CRM, Field.SFASCRIPTS, "FieldFormula", "Iscript_SFAHOME ");

Might yield the following URL:

http://mike.com/servlets/psc/testsite/EMPLOYEEPORTAL/CRM/s/WEBLIB_CRM.SFASCRIPTS.FieldFormula.IScript_SFAHOME

See Also

GenerateScriptContentRelURL, GenerateScriptPortalRelURL, GenerateScriptPortalURL, GenerateScriptRelativeURL.

Internet Script Classes (iScript)

Click to jump to top of pageClick to jump to parent topicGenerateScriptPortalRelURL

Syntax

GenerateScriptPortalRelURL(PORTAL.portalname, NODE.nodename, RECORD.recordname, FIELD.fieldname, event_name, function_name, [, keylist])

where keylist is a list of field references in the form:

[recordname.]field1 [, [recordname.]field2]. . .

OR

&RecordObject1 [, &RecordObject2]. . .

Description

Use the GenerateScriptPortalRelURL function to create a URL string that represents a relative reference to the specified iScript. The generated URL contains a reference to the portal service (psp) servlet.

If you want to generate an absolute URL for an iScript for the portal service servlet, use the GenerateScriptPortalURL function.

Parameters

portalname

Specify the name of the portal used for this request, prefixed with the reserved word PORTAL. You can also use a string, such as %Portal, for this value.

nodename

Specify the name of the node that contains the iScript, prefixed with the reserved word NODE. You can also use a string, such as %Node, for this value.

recordname

Specify the name of the record containing the iScript, prefixed with the reserved word RECORD.

fieldname

Specify the name of the field containing the iScript, prefixed with the reserved word FIELD.

event_name

Specify the name of the event containing the iScript. This is generally the FieldFormula event.

function_name

Specify the name of the iScript function.

keylist

An optional list of parameters used with the function. It can also be an already instantiated record object.

Returns

If the node has a Node Type of PIA, a string of the following format is returned:

/psp/s/recname.fieldname.event_name.function_name?parameters

If the node has a Node Type of ICType, a string of the following format is returned:

/portal/node/?ICType=Script&ICScriptProgramName=recname.fieldname.event_name.function_name?parameters

The question mark and the text following the question mark may or may not be included, depending on whether or not you specified a page and action or not.

This function returns a Null string if you specify an invalid portal or node.

Example

The following code:

&MyScriptURL = GenerateScriptPortalRelURL("EMPLOYEEPORTAL", "CRM", Record.WEBLIB_CRM, Field.SFASCRIPTS, "FieldFormula", "IScript_SFAHOME");

Might yield the following:

/psp/s/WEBLIB_CRM.SFASCRIPTS.FieldFormula.IScript_SFAHOME

See Also

GenerateScriptContentRelURL, GenerateScriptContentURL, GenerateScriptPortalURL, GenerateScriptRelativeURL.

Internet Script Classes (iScript)

Click to jump to top of pageClick to jump to parent topicGenerateScriptPortalURL

Syntax

GenerateScriptPortalURL(PORTAL.portalname, NODE.nodename, RECORD.recordname, FIELD.fieldname, event_name, function_name, [, keylist])

where keylist is a list of field references in the form:

[recordname.]field1 [, [recordname.]field2]. . .

OR

&RecordObject1 [, &RecordObject2]. . .

Description

Use the GenerateScriptPortalURL function to create a URL string that represents an absolute reference to the specified iScript for the portal servlet. The PortalURI of the node that hosts the specified portal is used in the generated URL. The URL contains a reference to the portal service (psp) servlet.

If you want to generate a URL for an iScript for the portal content (psc) servlet, use the GenerateScriptContentURL function.

Parameters

portalname

Specify the name of the portal used for this request, prefixed with the reserved word PORTAL. You can also use a string, such as %Portal, for this value.

nodename

Specify the name of the node that contains the iScript, prefixed with the reserved word NODE. You can also use a string, such as %Node, for this value.

recordname

Specify the name of the record containing the iScript, prefixed with the reserved word RECORD.

fieldname

Specify the name of the field containing the iScript, prefixed with the reserved word FIELD.

event_name

Specify the name of the event containing the iScript. This is generally the FieldFormula event.

function_name

Specify the name of the iScript function.

keylist

An optional list of parameters used with the function. It can also be an already instantiated record object.

Returns

If a node has a Node Type of PIA, a string of the following format is returned:

http://Portal URI of host portal/portal/node/s/recname.fieldname.event_name.function_name?parameters

If the node has a Node Type of ICType, a string of the following format is returned:

http://Portal URI of host node/portal/node/?ICType=Script&ICScriptProgramName=recname.fieldname.event_name.function_name?parameters

The question mark and the text following the question mark may or may not be included, depending on whether or not you specified a page and action or not.

This function returns a Null string if you specify an invalid portal or node.

Example

The following code:

&MyScriptURL = GenerateScriptPortalURL("EMPLOYEEPORTAL", "CRM", Record.WEBLIB_CRM, Field.SFASCRIPTS, "FieldFormula", "IScript_SFAHOME");

Might yield the following:

http://mike.com/servlets/psp/testsite/EMPLOYEEPORTAL/CRM/s/WEBLIB_CRM.SFASCRIPTS.FieldFormula.IScript_SFAHOME

See Also

GenerateScriptContentRelURL, GenerateScriptContentURL, GenerateScriptPortalRelURL, GenerateScriptRelativeURL.

Internet Script Classes (iScript)

Click to jump to top of pageClick to jump to parent topicGenerateScriptRelativeURL

Syntax

GenerateScriptRelativeURL(PORTAL.portalname, NODE.nodename, RECORD.recordname, FIELD.fieldname, event_name, function_name, [, keylist])

where keylist is a list of field references in the form:

[recordname.]field1 [, [recordname.]field2]. . .

OR

&RecordObject1 [, &RecordObject2]. . .

Description

Use the GenerateScriptRelativeURL function to create a relative URL string that represents a relative reference to the specified iScript. The relative reference is suitable for use on any page that has the simple URL format.

If you want to generate an absolute URL for an iScript, use either the GenerateScriptContentURL or GenerateScriptPortalURL function.

Parameters

portalname

Specify the name of the portal used for this request, prefixed with the reserved word PORTAL. You can also use a string, such as %Portal, for this value.

nodename

Specify the name of the node that contains the iScript, prefixed with the reserved word NODE. You can also use a string, such as %Node, for this value.

recordname

Specify the name of the record containing the iScript, prefixed with the reserved word RECORD.

fieldname

Specify the name of the field containing the iScript, prefixed with the reserved word FIELD.

event_name

Specify the name of the event containing the iScript. This is generally the FieldFormula event.

function_name

Specify the name of the iScript function.

keylist

An optional list of parameters used with the function. It can also be an already instantiated record object.

Returns

If the node has a Node Type of PIA, a string of the following format is returned:

portal/node/s/recname.fieldname.event_name.function_name?parameters

If the node has a Node Type of ICType, a string of the following format is returned:

portal/node/?ICType=Script&ICScriptProgramName=recname.fieldname.event_name.function_name?parameters

The question mark and the text following the question mark may or may not be included, depending on whether or not you specified a page and action or not.

This function returns a Null string if you specify an invalid portal or node.

Example

The following code:

&MyScriptURL = GenerateScriptRelativeURL("EMPLOYEEPORTAL", "CRM", Record.WEBLIB_CRM, Field.SFASCRIPTS, "FieldFormula", "IScript_SFAHOME");

Might yield the following:

../../../EMPLOYEEPORTAL/CRM//s/WEBLIB_CRM.SFASCRIPTS.FieldFormula.IScript_SFAHOME

See Also

GenerateScriptContentRelURL, GenerateScriptContentURL, GenerateScriptPortalRelURL, GenerateScriptPortalURL.

Internet Script Classes (iScript)

Click to jump to top of pageClick to jump to parent topicGenerateTree

Syntax

GenerateTree(&rowset [, TreeEventField])

Description

Use the GenerateTree function to display data in a tree format, with nodes and leaves. The result of the GenerateTree function is an HTML string, which can be displayed in an HTML area control. The tree generated by GenerateTree is called an HTML tree.

The GenerateTree function can be used in conjunction with the Tree Classes to display data from trees created using Tree Manager.

The GenerateTree function works with both an HTML area control and a hidden field. The TreeEventField parameter contains the contents of the invisible character field used to process the HTML tree events.

When an end-user selects a node, expands a node, collapses a node, or uses one of the navigation links, that event (end-user action) is passed to the invisible field, and the invisible field's FieldChange PeopleCode is executed.

See Also

Using HTML Tree Actions (Events).

Building HTML Tree Pages

Parameters

&rowset

Specify the name of the rowset you've populated with tree data.

TreeEventField

Specify the contents of the invisible character field used to process the HTML tree events. The first time the GenerateTree function is used, that is, to generate the initial tree, you don't need to include this parameter. Subsequent calls require this parameter.

Returns

A string that contains HTML code that can be used with the HTML control to display a tree.

Example

In the following example, TREECTLEVENT is the name of the invisible control field that contains the event string that was passed from the browser.

HTMLAREA = GenerateTree(&TREECTL, TREECTLEVENT);

See Also

Using the GenerateTree Function.

Click to jump to top of pageClick to jump to parent topicGenerateWorklistPortalURL

Syntax

GenerateWorklistPortalURL(PORTAL.portalname, NODE.nodename, BusProc, Activity, Event, Worklist, Instance)

Description

Use the GenerateWorklistPortalURL function to create a URL string that represents an absolute reference the specified Worklist (URL) on the portal servlet.

The PortalURI of the node that hosts the specified portal is used in the generated URL. The generated URL contains a reference to the portal service (psp) servlet.

If you want to generate a relative URL, use the GenerateWorklistRelativeURL function.

Parameters

portalname

Specify the name of the portal used for this request, prefixed with the reserved word PORTAL. You can also use a string, such as %Portal, for this value.

nodename

Specify the name of the node that contains the content, prefixed with the reserved word NODE. You can also use a string, such as %Node, for this value.

BusProc

Specify the business process of the Worklist.

Activity

Specify the activity of the Worklist.

Event

Specify the event of the Worklist.

Instance

Specify the instance of the Worklist.

Returns

A string of the following format:

http://PortalURI/Portal/node/w/BusProc.Activity.Event.Worklist.Instance

This function returns a Null string if you specify an invalid portal or node.

See Also

GenerateWorklistRelativeURL.

Internet Script Classes (iScript)

Understanding PeopleSoft Workflow

Click to jump to top of pageClick to jump to parent topicGenerateWorklistRelativeURL

Syntax

GenerateWorklistRelativeURL(PORTAL.portalname, NODE.nodename, BusProc, Activity, Event, Worklist, Instance)

Description

Use the GenerateWorklistRelativeURL function to create a URL string that represents a relative reference to the specified Worklist on the portal servlet. The relative reference is suitable for use on any page that itself has the simple URL format.

If you want to generate an absolute URL, use the GenerateWorklistPortalURL function.

Parameters

portalname

Specify the name of the portal used for this request, prefixed with the reserved word PORTAL. You can also use a string, such as %Portal, for this value.

nodename

Specify the name of the node that contains the content, prefixed with the reserved word NODE. You can also use a string, such as %Node, for this value.

BusProc

Specify the business process of the Worklist.

Activity

Specify the activity of the Worklist.

Event

Specify the event of the Worklist.

Instance

Specify the instance of the Worklist.

Returns

A string of the following format:

../../../Portal/Node/w/BusProc.Activity.Event.Worklist.Instance

This function returns a Null string if you specify an invalid portal or node.

Example

Given the following activity:

Example activity

The following is an example PeopleCode statement used to access this activity:

GenerateWorklistRelativeURL(%Portal, %Node, "Administer Workflow", "Find Timeout Worklists", "Worklist Current Operator", "Timeout Notification", 1);

See Also

GenerateWorklistPortalURL.

Internet Script Classes (iScript)

Understanding PeopleSoft Workflow

Click to jump to top of pageClick to jump to parent topicGenToken

Syntax

GenToken()

Description

Use the GenToken function to create an authentication token for the user currently logged in, as a string.

Generally this function is used in an application engine program when an authentication token is not automatically generated. However, it can be used anytime. The token that is generated is usually passed to another process that has no token.

Parameters

None.

Returns

A string containing the authentication token.

See Also

%AuthenticationToken

Click to jump to top of pageClick to jump to parent topicGetAESection

Syntax

GetAESection(ae_applid, ae_section [, effdt])

Description

Use the GetAESection function to open and associate an AESection PeopleCode object with the base section, as specified. If no base section by the specified name is found, one is created. This enables you to create base sections as needed.

Warning! When you open or get an AESection object, (that is, the base section) any existing steps in the section are deleted.

After you’ve instantiated the AESection object, set the template section using the SetTemplate AESection class method. You can copy steps from the template section to the base section before you start the PeopleSoft Application Engine program. This is useful for applications that let users input their "rules" into a user-friendly page, then convert these rules, at save time, into Application Engine constructs.

When an AESection is opened (or accessed), the system first looks to see if it exists with the given input parameters. If such a section doesn’t exist, the system looks for a similar section based on market, database platform, and effective date.

The AESection Object is designed for use within an online program. Typically, dynamic sections should be constructed in response to an end user action.

Note. Do not call an AESection object from an Application Engine PeopleCode Action. If you need to access another section, use the CallSection action instead.

Parameters

ae_applid

Specifies the application ID of the section you want to modify.

ae_section

Specifies the section name of the base section you want to modify. If no base section by the specified name is found, one is created.

effdt

Specifies the effective date of the section you want to modify (optional).

Returns

An AESection object is returned.

See Also

AESection Class.

Open

AESection Example

Click to jump to top of pageClick to jump to parent topicGetAnalyticGrid

Syntax

GetAnalyticGrid(PAGE.pagename, gridname)

Description

Use the GetAnalyticGrid function to instantiate an analytic grid object from the AnalyticGrid class, and populates it with the grid specified by gridname, which is the Page Field Name on the General tab of that analytic grid’s page field properties.

Specify a grid name consisting of any combination of uppercase letters, digits and "#", "$", "@", and "_".

Note. PeopleSoft builds a page grid one row at a time. Because the AnalyticGrid class applies to a complete grid, you can’t attach PeopleCode that uses the AnalyticGrid class to events that occur before the grid is built; the earliest event you can use is the page Activate event.

See Activate Event.

Using the Grid Name

When you place an analytic grid on a page, the grid is automatically named the same as the name of the primary record of the scroll for the grid (in the Page Field Name.)

Note. If the name of the record changes, the Page Field Name is not automatically updated. You must change this name if you want the name of the grid to reflect the name of the record.

This is the name you use with the GetAnalyticGrid function. You can change this name on the General tab of the Analytic Grid control properties.

To change a grid name:

  1. Open the page in PeopleSoft Application Designer, select the analytic grid and access the Analytic Grid control properties.

  2. On the General tab, type the new grid name in Page Field Name.

Note. Every grid on a page must have a unique name.

Parameters

PAGE. pagename

Specify the name of the page definition containing the grid you want to access.

gridname

Specify the Page Field Name on the General tab of the grid’s page field properties.

Returns

A reference to an AnalyticGrid object.

See Also

Analytic Grid Classes

Click to jump to top of pageClick to jump to parent topicGetAnalyticInstance

Syntax

GetAnalyticInstance(ID)

Description

Use the GetAnalyticInstance function to return a reference to the AnalyticInstance object as specified by the ID.

The analytic instance specified by ID must already be created before using this function.

Parameters

ID

Specify the analytic instance identifier that you want to access.

Returns

An AnalyticInstance object if successful, null otherwise.

See Also

CreateAnalyticInstance

CheckStatus

Click to jump to top of pageClick to jump to parent topicGetArchPubHeaderXmlDoc

Syntax

GetArchPubHeaderXmlDoc(PubID, PubNode, ChannelName, VersionName[, Segment])

Description

Use the GetArchPubHeaderXMLDoc function to retrieve an archived message header from the message queue.

This function has been deprecated. You will receive an error if you use this function.

See Also

Consuming Services

Click to jump to top of pageClick to jump to parent topicGetArchPubXmlDoc

Syntax

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

Description

Use the GetArchPubXmlDoc function to retrieve an archived message from the message queue.

This function has been deprecated. You will receive an error if you use this function.

See Also

Managing Error Handling, Logging, Tracing, and Debugging.

Click to jump to top of pageClick to jump to parent topicGetArchSubXmlDoc

Syntax

GetArchSubXmlDoc(PubID, PubNode, ChannelName, VersionName, MessageName[, Segment])

Description

Use the GetArchSubXmlDoc function to retrieve an archived message from the message queue.

This function has been deprecated. You will receive an error if you use this function.

See Also

Understanding PeopleSoft Integration Broker

Click to jump to top of pageClick to jump to parent topicGetAttachment

Syntax

GetAttachment(URLSource, SysFileName, LocalFile [, LocalDirEnvVar[, PreserveCase]])

where URLSource can have one of the following forms:

URL.URLname

OR a string URL, such as

ftp://user:password@ftp.ps.com/

Note. You cannot specify a different port for an attachment when using an FTP server. You can only use the default port of 21.

Note. The file attachment functionality does not support SFTP or FTPS.

Description

Use the GetAttachment function to transfer a file from the file server to the application sever.

File Name Considerations

When the file is transferred, the following characters are replaced with an underscore:

Note. The @ sign is not changed to an underscore on files transferred with this function.

Considerations Using DB2 UDB for OS/390 and z/OS Databases

When you use the GetAttachment function on either the DB3 UDB for OS/390 or z/OS databases, you may need to convert the file for the transfer to complete correctly.

For example, you can use the following conversion, and place it in a shell script named convert.sh:

dd if=$1 of=$1.temp conv=ebcdic tr -d '\045' < $1.temp > $1.temp2 tr '\015' '\n' < $1.temp2 > $1.temp3

At this point $1.temp3 contains the file that GetFile can use.

Parameters

URLSource

A reference to a URL. This can be either a URL name, in the form URL.URLName, or a string. This is where the file is transferred to.

SysFileName

The relative path and filename of the file on the file server. This is appended to URLSource to make up the full URL where the file is transferred from. This parameter takes a string value.

 

Note. The URLSource requires "/" slashes. Because SysFileName is appended to the URL, it also requires only "/" slashes. "\" are NOT supported in anyway for either the URLSource or the SysFileName parameter.

LocalFile

The name, and possible full path, to the destination file on the application server. This parameter takes a string value.

If you specify only a file name, the file is assumed to be in the directory specified by the TMP environment variable or the directory specified by LocalDirEnvVar. If the file is not in the TMP directory and you don't specify LocalDirEnvVar you must use the full path name as appropriate to the operating system (that is, on Unix use "\").

LocalDirEnvVar

The name of the environment variable containing path information. If specified, the path value in the environment variable is prepended to LocalFile. Use this if you don't want to hard code path names in the LocalFile parameter. This parameter takes a string value.

 

Note. Only operating system environment variables are recognized with this parameter, rather than variables defined in configuration files.

PreserveCase

Specify a Boolean value to indicate whether the case of the directory and file name specified with DirAndFileName are preserved or not; true, preserve the case, false, convert the filename extension to all lower case letters. The default value is false.

Returns

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

Numeric Value

Constant Value

Description

0

%Attachment_Success

File was transferred successfully.

1

%Attachment_Failed

File was not successfully transferred.

Example

The following transfers the file "resume.txt" from the file server to the application server using ftp.

GetAttachment("ftp://anonymous:hobbit1@ftp.ps.com/HRarchive/", "NewHire/11042000resume.txt", "c:/NewHires/resume.txt";

In this example, all resumes are in the directory NewHires, which is pointed to by the environment variable RESUMES.

&SysFileName = %DATE | &LASTNAME; GetAttachment(URL.MYFTP, &SysFileName, "resume.txt", "RESUMES");

The following example gets employee photos from an ftp archive, and writes them to a record.

Local File &FILE; Local Record &REC; Local SQL &SQL; &REC = CreateRecord(Record.EMPL_PHOTO); &SQL = CreateSQL("%SelectAll(:1)", Record.EMPL_PHOTO); While &SQL1.Fetch(&REC) /* photos are stored in FTP archive by EmplID */ &EmplId = &REC.EmplId.Value; &SysFileName = &EmplId | "_PHOTO.GIF"; /* Store files with same name on local system */ GetAttachment(URL.FTPARCHIVE, &SysFileName, &SysFileName, "PHOTOS"); /* get the file */ &FileName = "C:\HRArchive\Photos" | &SysFileName; &FILE = GetFile(&FileName, "w", "a", %FilePath_Absolute); /* Write file to record */ &FILE.WriteRaw(&REC.EMPLOYEE_PHOTO.Value); End-While; &FILE.Close();

See Also

AddAttachment, DeleteAttachment, PutAttachment, ViewAttachment.

Using File Attachments in Applications

Click to jump to top of pageClick to jump to parent topicGetBiDoc

Syntax

GetBiDoc(XMLstring)

Description

Use the GetBiDoc function to create a BiDocs structure. You can populate the structure with data from XMLstring. This is part of the incoming Business Interlink functionality, which enables PeopleCode to receive an XML request and return an XML response.

Parameters

XMLstring

A string containing XML. You can specify a NULL string for this parameter, that is, two quotation marks ("") without a space between them.

Return Value

A BiDocs object.

Example

The following example gets an XML request, puts it into a text string, and puts that into a BiDoc. After this is done, the GetDoc method and the GetValue method can get the value of the skills XML element, which is contained within the postreq XML element in the XML request.

Local BIDocs &rootInDoc, &postreqDoc; Local string &blob; Local number &ret; &blob = %Request.GetContentBody(); /* process the incoming xml(request)- Create a BiDoc and fill with the request*/ &rootInDoc = GetBiDoc(&blob); &postreqDoc = &rootInDoc.GetDoc("postreq"); &ret = &postreqDoc.GetValue("skills", &skills);

You can also create an empty BiDoc with GetBiDoc, as in the following example.

Local BIDocs &rootInDoc, &postreqDoc; Local string &blob; Local number &ret; &blob = %Request.GetContentBody(); /* process the incoming xml(request)- Create a BiDoc and fill with the request*/ &rootInDoc = GetBiDoc(""); &ret = &rootInDoc.ParseXMLString(&blob); &postreqDoc = &rootInDoc.GetDoc("postreq"); &ret = &postreqDoc.GetValue("skills", &skills);

See Also

Business Interlinks documentation on Customer Connection

Click to jump to top of pageClick to jump to parent topicGetCalendarDate

Syntax

GetCalendarDate(comparedate, periods, periodadjustment, outfieldname, company, paygroup)

Description

Use the GetCalendarDate function to return the value of a Date field from the PS_PAY_CALENDAR table. If a table entry is not found, GetCalendarDate returns 1899-01-01.

Processing Rules

The following are the processing rules for GetCalendarDate:

  1. The function SELECTs all the values for outfieldname, PAY_BEGIN_DT and PAY_END_DT from PS_PAY_CALENDAR. The result set is sorted in increasing PAY_END_DT order.

  2. A SQL SELECT statement is generated in the following form:

  3. SELECT outfieldname, PAY_BEGIN_DT, PAY_END_DT FROM PS_PAY_CALENDAR WHERE COMPAny=:1 AND PAYGROUP=:2 ORDER BY PAY_END_DT;

  4. Rows are fetched from the result set until the value of comparedate falls between PAY_BEGIN_DT and PAY_END_DT. The value of outfieldname is stored in a storage stack.

  5. A work variable equal to the value in periods is set.

  6. If the value of outfieldname in the located result row is equal to comparedate, then the value in periodadjustment is added to the work variable. Because periodadjustment may be negative, the result may be negative.

  7. If the work variable is negative then the saved value of outfieldname is returned from the storage stack at the level specified by the work variable. If the work variable is positive then fetch forward the number of times specified by the work variable. The value of outfieldname is returned from the most recently fetched (current) row.

Parameters

comparedate

A date field set by the caller as the date of interest, for example, "1997-02-17."

periods

A numeric variable set by the caller specifying the number of periods forward or backward to be returned.

periodadjustment

A numeric variable that adjusts the periods if the comparedate equals the period end date. This is typically used to adjust for period end dates. Usually the periodadjustment is either -1, 0, or 1.

outfieldname

The name of a date field in the PS_PAY_CALENDAR table. For example PAY_BEGIN_DT. The value of this field is not referenced or modified by the routine, but the name of the field is used to build a SQL SELECT statement and to indicate which value from the table to return in the return date.

company

A field set by the caller to be equal to the company code of interest, for example, "CCB".

paygroup

A variable set by the caller to be equal to the PayGroup code of interest, for example, "M01".

Returns

Returns a Date value from the PS_PAY_CALENDAR table.

Example

The following examples use the sample PS_PAY_CALENDAR entries in the following table. In the example, comparedate and the result date are Date type fields defined in some record.

COMPANY

PAYGROUP

PAY_END_DT

PAY_BEGIN_DT

CHECK_DT

CCB

MO1

1997-01-31

1997-01-01

1997-01-31

CCB

MO1

1997-02-28

1997-02-01

1997-02-28

CCB

MO1

1997-03-31

1997-03-01

1997-03-29

CCB

MO1

1997-04-30

1997-04-01

1997-04-30

CCB

MO1

1997-05-31

1997-05-01

1997-05-31

CCB

MO1

1997-06-30

1997-06-01

1997-06-28

CCB

MO1

1997-07-31

1997-07-01

1997-07-31

CCB

MO1

1997-08-31

1997-08-01

1997-08-30

CCB

MO1

1997-09-30

1997-09-01

1997-09-30

CCB

MO1

1997-10-31

1997-10-01

1997-10-31

CCB

MO1

1997-11-30

1997-11-01

1997-11-27

CCB

MO1

1997-12-31

1997-12-01

1997-12-31

CCB

SM1

1997-01-15

1997-01-01

1997-01-15

Find the begin date of the pay period containing the date 1997-05-11 (the value of &COMPAREDate). The result date returned would be 1997-05-01.

&RESULT_Date = GetCalendarDate(&COMPAREDate, 0, 0, PAY_BEGIN_DT, COMPAny, PAYGROUP);

Or:

&RESULT_Date = GetCalendarDate(&COMPAREDate, 1, -1, PAY_BEGIN_DT, COMPAny, PAYGROUP);

Click to jump to top of pageClick to jump to parent topicGetChart

Syntax

GetChart(RecordName.FieldName)

Description

Use the GetChart function to get a reference to a chart object. You associate a record and field name with a chart definition in PeopleSoft Application Designer.

Parameters

RecordName.FieldName

Specify the record and field name associated with the chart.

Returns

A reference to a chart object.

Example

&MyChart = GetChart(Chart_Record.Chart_Field);

See Also

Chart Class.

Click to jump to top of pageClick to jump to parent topicGetChartURL

Syntax

GetChartURL(&Chart)

Description

Use the GetChartURL function to generate the URL of a chart object. This URL can then be used in your application for displaying a chart.

Parameters

&Chart

Specify an already instantiated chart object.

Returns

A URL as a string.

Example

Function IScript_GetChartURL() local object &MyChart; local string &MyURL; &MyChart = CreateObject("Chart"); &MyChart .SetData = xx; /* xx will be a data row set */ &MyURL = %Response.GetChartURL(&MyChart); &sMap = &oChart.ImageMap; %Response.Write("<HTML><IMG SRC="); %Response.Write(&MyURL); %Response.Write(" USEMAP=#THEMAP></IMG><MAP NAME=THEMAP>"); %Response.Write(&sMap); %Response.Write("</MAP></HTML>"); End-Function;

See Also

Chart Class.

Click to jump to top of pageClick to jump to parent topicGetCwd

Syntax

GetCwd()

Description

Use the GetCwd function to determine the current working directory of the process that executes it. This means that in PeopleSoft Pure Internet Architecture it returns the current working directory on the server, in an Application Engine program it returns the current working directory of the Application Engine process, and so on.

Returns

Returns a string containing the path of the current working directory.

Example

The example stores a string specifying the current working directory in &CWD.

&CWD = GetCwd();

See Also

GetEnv, ExpandEnvVar.

Click to jump to top of pageClick to jump to parent topicGetEnv

Syntax

GetEnv(env_var_str)

Description

Use the GetEnv function to return the value of an environment variable specified by env_var_str as a string. If the environment variable does not exist, it returns a null string.

You can use the GetEnv function to determine the actual path of PS_HOME. You could use this with the Exec function, which automatically prepends the command string with the path of PS_HOME.

Parameters

env_var_str

A string containing an environment variable.

Returns

Returns a string equal to env_var_str with any enclosed environment variables expanded to their values.

Example

Assume that the environment string NETDRIVE is equal to "N:". The following statement returns "N:" in &NETDRIVE:

&NETDRIVE = GetEnv("netdrive");

Note that on UNIX systems, the environment variable names are case-sensitive. That is, "netdrive" is a different variable from "NetDrive".

See Also

GetCwd, ExpandEnvVar.

Click to jump to top of pageClick to jump to parent topicGetField

Syntax

GetField([recname.fieldname])

Description

Use the GetField function to create a reference to a field object for the current context; that is, from the row containing the currently executing program.

If you don't specify recname.fieldname, the current field executing the PeopleCode is returned.

Note. For PeopleCode programs located in events that are not associated with a specific row, record, and field at the point of execution this function is invalid. That is, you cannot use this function in PeopleCode programs on events associated with high-level objects like pages or components. For events associated with record level programs (like component record), this function is valid, but it must be specified with a field name, as there is an assumed record, but no assumed field name.

When GetField is used with an associated record and field name on component buffer data, the following is assumed:

&FIELD = GetRow().recname.fieldname;

Parameters

recname.fieldname

If you don't want to refer to the field executing the PeopleCode, specify a record name and field name.

Returns

This function returns a field object that references the field from the specified record.

Example

Local Field &CHARACTER; &CHARID = GetField(FIELD.CHAR_ID);

See Also

Field Class, GetField.

Accessing the Data Buffer

Click to jump to top of pageClick to jump to parent topicGetFile

Syntax

GetFile(filename, mode [, charset] [, pathtype])

Description

Use the GetFile function to instantiate a new file object from the File class, associate it with an external file, and open the file so you can use File class methods to read from or write to it.

GetFile is similar to the Open file class method, but Open associates an existing file object with an external file. If you plan to access only one file at a time, you need only one file object. Use GetFile to instantiate a file object for the first external file you access, then use Open to associate the same file object with as many different external files as you want. You need to instantiate multiple file objects with GetFile only if you expect to have multiple files open at the same time.

Working With Relative Paths

If you specify a relative path, that path is appended to the path specified by an environmental variable, if the variable exists, in a particular order. This means if the first environmental variable in order is found, that is the one that's used. If it isn't found, the next one is searched for, and if found, is used, and so on.

If GetFile is called from Application Engine when running standalone that is, when not within an application server domain), the following environmental variables are valid, and are searched for in the following order:

  1. PS_FILEDIR[\relative_path]

  2. PS_SERVDIR\Files[\relative_path]

If the code is not running on an application server, the following environmental variables are valid, and are searched for in the following order:

  1. PS_FILEDIR[\relative_path]

  2. PS_SERVDIR\Files[\relative_path]

  3. TEMP[\relative_path]

The PS_FILEDIR environmental variable is not initialized and set to a path automatically. If you want to use this environmental variable, you must set it yourself.

Note. Your system security should verify if a user has the correct permissions before allowing access to a drive (for example, if a user changes their TEMP environmental variable to a network drive they don’t normally have access to, your system security should detect this.)

Parameters

filespec

Specify the name, and optionally, the path, of the file you want to open.

mode

A string indicating how you want to access the file. The mode can be one of the following:

"R" (Read mode): opens the file for reading, starting at the beginning.

"W" (Write mode): opens the file for writing.

Warning! When you specify Write mode, any existing content in the file is discarded.

"A" (Append mode): opens the file for writing, starting at the end. Any existing content is retained.

"U" (Update mode): opens the file for reading or writing, starting at the beginning of the file. Any existing content is retained. Use this mode and the GetPosition and SetPosition methods to maintain checkpoints of the current read/write position in the file.

In Update mode, any write operation clears the file of all data that follows the position you set.

Note. Currently, the effect of the Update mode and the GetPosition and SetPosition methods is not well defined for Unicode files. Use the Update mode only on files stored with a non-Unicode character set.

"E" (Conditional "exist" read mode): opens the file for reading only if it exists, starting at the beginning. If it doesn’t exist, the Open method has no effect. Before attempting to read from the file, use the IsOpen property to confirm that it’s open.

"N" (Conditional "new" write mode): opens the file for writing, only if it doesn’t already exist. If a file by the same name already exists, the Open method has no effect. Before attempting to write to the file, use the IsOpen property to confirm that it’s open. You can insert an asterisk (*) in the filename to ensure that a new file is created. The system replaces the asterisk with numbers starting at 1 and incrementing by 1, and checks for the existence of a file by each resulting name in turn. It uses the first name for which a file doesn’t exist. In this way you can generate a set of automatically numbered files. If you insert more than one asterisk, all but the first one are discarded.

charset

A string indicating the character set you expect when you read the file, or the character set you want to use when you write to the file. You can abbreviate Unicode UTF-16 to "U" and the host operating system's default non-Unicode (sometimes referred to as the ANSI character set) to “A”. All other character sets must be spelled out in full, for example, ASCII, THAI, or UTF8.

If “A” is specified as the character set, or you don't specify a character set, the character set used is dependent on the application server configuration. On a Windows application server, the default non-Unicode character set is dependent on the Windows ANSI Codepage (ACP) which can be checked using the DOS command chcp. On a Unix application server, the default non-Unicode character set is specified in the application server configuration file, psappsrv.cfg, and can be modified using PSADMIN. You can also use a record field value to specify the character set (for example, RECORD.CHARSET.)

A list of supported character set names valid for this argument can be found in PeopleTools 8.49 PeopleBook: Global Technology.

See Character Sets in the PeopleSoft Pure Internet Architecture.

Note. If you attempt to read data from a file using a different character set than was used to write that data to the file, the methods used generate a runtime error or the data returned is unusable.

When a file is opened for reading using the “U” charset argument, GetFile expects the file to begin with a Unicode Byte Order Mark (BOM), otherwise known as a sentinal. This mark indicates whether the file is written in big endian order or little endian order. A BOM consisting of the hex value 0xFEFF indicates a big endian file, a BOM consisting of the hex value 0xFFEF indicates a little endian file. If the Unicode UTF-16 file being opened does not start with a BOM, an error is returned. The BOM is automatically stripped from the file when it is read into the buffers by GetFile.

When a file is opened for writing using the “U” charset argument, the Unicode BOM is automatically written to the start of the file, dependent on whether the application server hardware platform operates in little endian or big endian mode.

Byte Order Marks are not expected or supported for files in other character sets, including UTF8.

Note. When working with XML documents, specify UTF8 for charset.

If you are writing an XML file using a different charset, you must remember to include a charset declaration in the XML file.

pathtype

If you have prepended a path to the file name, 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 the path is an absolute path, whatever path you specify is used verbatim. You must specify a drive letter as well as the complete path. You can’t use any wildcards when specifying a path.

The function automatically converts platform-specific separator characters to the appropriate form for where your PeopleCode program is executing. On a WIN32 system, UNIX "/" separators are converted to "\", and on a UNIX system, WIN32 "\" 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

A file object if successful, Null otherwise.

Example

The following example opens an existing Unicode file for reading:

&MYFILE = GetFile(&SOMENAME, "E", "U"); If &MYFILE.IsOpen Then while &MYFILE.ReadLine(&SOMESTRING); /* Process the contents of each &SOMESTRING */ End-While; &MYFILE.Close(); End-If;

The following example opens a numbered file for writing in a non-Unicode format, without overwriting any existing files:

&MYFILE = GetFile("c:\temp\item*.txt", "N", %FilePath_Absolute); If &MYFILE.IsOpen Then &MYFILE.WriteLine("Some text."); &MYFILE.Close(); End-If;

The following example uses the CHARSET field to indicate the character set to be used:

&MYFILE = GetFile("INPUT.DAT", "R", RECORD.CHARSET);

See Also

FileExists, FindFiles, GetFile.

File Class

Open

GetPosition

SetPosition

IsOpen

File Access Interruption Recovery

Click to jump to top of pageClick to jump to parent topicGetGanttChart

Syntax

GetGanttChart([RecordName.FieldName])

Description

Use the GetGanttChart function to get a reference to a Gantt chart object. You associate a record and field name with a chart definition in PeopleSoft Application Designer.

Parameters

RecordName.FieldName

Specify the record and field associated with the chart you want to get.

Returns

A reference to a chart object.

Example

&oGantt = GetGanttChart(QE_CHART_DUMREC.QE_CHART_FIELD);

See Also

Chart Class

Using Charts

Click to jump to top of pageClick to jump to parent topicGetGrid

Syntax

GetGrid(PAGE.pagename, gridname)

Description

Use the GetGrid function to instantiate a grid object from the Grid class, and populates it with the grid specified by gridname, which is the Page Field Name on the General tab of that grid’s page field properties.

Use the GetGrid function to return a reference to a grid object. If you want to access an AnalyticGrid, use the GetAnalyticGrid function instead.

Specify a grid name consisting of any combination of uppercase letters, digits and "#", "$", "@", and "_".

Note. PeopleSoft builds a page grid one row at a time. Because the Grid class applies to a complete grid, you can’t attach PeopleCode that uses the Grid class to events that occur before the grid is built; the earliest event you can use is the page Activate Event.

See Activate Event.

Using the Grid Name

When you place a grid on a page, the gird is automatically named the same as the name of the primary record of the scroll for the grid (in the Page Field Name.)

Note. If the name of the record changes, the Page Field Name is not automatically updated. You must change this name if you want the name of the grid to reflect the name of the record.

This is the name you use with the GetGrid function. You can change this name on the Record tab of the Grid properties.

Changing a grid name

To change a grid name:

  1. Open the page in PeopleSoft Application Designer, select the grid and access the page field properties.

  2. On the General tab, type the new grid name in Page Field Name.

Note. Every grid on a page must have a unique name.

Parameters

PAGE. pagename

Specify the name of the page definition containing the grid you want.

gridname

Specify the Page Field Name on the General tab of the grid’s page field properties.

Returns

A Grid object populated with the requested grid.

Example

This example retrieves the second grid named "EMPL_GRID" within a scroll:

local Grid &MYGRID; &MYGRID = GetGrid(PAGE.EMPLOYEE_CHECKLIST, "EMPL_GRID");

See Also

GetColumn.

GetAnalyticGrid

Click to jump to top of pageClick to jump to parent topicGetHTMLText

Syntax

GetHTMLText(HTML.textname [, paramlist])

Where paramlist is an arbitrary-length list of values of undetermined (Any) data type in the form:

inval1 [, inval2] ...

Description

Use the GetHTMLText function to retrieve a predefined HTML text from an HTML definition in the user's current language, or the base language if no entry exists in the user's current language. If any values are included in paramlist, they are substituted into the HTML text based on positional reference (for example, %BIND(:1) is the first parameter, %BIND(:2) is the second, and so on.)

Note. Use the GetHTMLText function only to retrieve HTML, or HTML that contains a JavaScript program, from an HTML definition. If you have an HTML definition that contains only JavaScript, use the GetJavaScriptURL response class method to access it.

See GetJavaScriptURL.

Restrictions on Use

Use this function with the PeopleSoft Pure Internet Architecture. If run from a 2 tier environment, the parameter substitution does not take place.

Parameters

HTML. textname

Specify the name of an existing HTML text from an HTML definition.

Returns

The resulting HTML text is returned as a string.

Example

The following is the text in the HTML definition TEST_HTML:

This is a %BIND(:1) and %BIND(:2) test.

The following is the PeopleCode program:

Local Field &HTMLfield; &string = GetHTMLText(HTML.TEST_HTML, "good", "simple"); &HTMLfield = GetRecord(Record.CHART_DATA).HTMLAREA; &HTMLfield.Value = &string;

The output from &string (displayed in an HTML area control) is:

This is a good and simple test.

See Also

Internet Script Classes (iScript).

Using HTML Definitions and the GetHTMLText Function

Using HTML Areas

Click to jump to top of pageClick to jump to parent topicGetImageExtents

Syntax

GetImageExtents(IMAGE.ImageName)

Description

Use the GetImageExtents function to return the width and height of the image specified by ImageName.

Parameters

ImageName

Specify the name of the image on the page. This image must exist on the page.

Returns

An array of data type number, where element 1 is the image height and element 2 is the image width.

Example

Local array of number &ImageExtents; &ImageExtents = GetImageExtents(Image.PT_TREE_EXPANDED); WinMessage("Height is " | &ImageExtents[1] | " and width is " | &ImageExtents[2]);

See Also

Specifying Image Field Attributes.

Click to jump to top of pageClick to jump to parent topicGetInterlink

Syntax

GetInterlink(Interlink.name)

Description

Use the GetInterlink function to instantiate a Business Interlink definition object based on a Business Interlink definition created in PeopleSoft Application Designer. The Business Interlink object can provide a gateway for PeopleSoft applications to the services of any external system.

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

Generally, do not use the GetInterlink function in a program you create from scratch. If you drag a Business Interlink definition from the project workspace (in PeopleSoft Application Designer) to an open PeopleCode editor window, a "template" is created, with values filled in based on the Business Interlink definition you dragged in.

The following is the template created from dragging the Business Interlink definition LDAP_SEARCHBIND to an open PeopleCode editor window.

/* ===> This is a dynamically generated PeopleCode template to be used only as a helper to the application developer. You need to replace all references to '<*>' OR default values with references to PeopleCode variables and/or a Rec.Fields.*/ /* ===> Declare and instantiate: */ Local Interlink &LDAP_SEARCHBI_1; Local BIDocs &inDoc; Local BIDocs &outDoc; Local Boolean &RSLT; Local number &EXECRSLT; &LDAP_SEARCHBI_1 = GetInterlink(INTERLINK.LDAP_SEARCHBIND); /* ===> You can use the following assignments to set the configuration parameters. */ &LDAP_SEARCHBI_1.Server = "jtsay111198.peoplesoft.com"; &LDAP_SEARCHBI_1.Port = 389; &LDAP_SEARCHBI_1.User_DN = "cn=Admin,o=PeopleSoft"; &LDAP_SEARCHBI_1.Password = &password; &LDAP_SEARCHBI_1.UserID_Attribute_Name = "uid"; &LDAP_SEARCHBI_1.URL = "///file:C:/User/Documentum/XML%20Applications/proddoc/peoplebook_upc/peoplebook_upc.dtd"; &LDAP_SEARCHBI_1.BIDocValidating = "Off"; /* ===> You might want to call the following statement in a loop if there is more than one row of data to be added. */ /* ===> Add inputs: */ &inDoc = &LDAP_SEARCHBI_1.GetInputDocs(""); &ret = &inDoc.AddValue("User_ID", <*>); &ret = &inDoc.AddValue("User_Password", <*>); &ret = &inDoc.AddValue("Connect_DN", <*>); &ret = &inDoc.AddValue("Connect_Password", <*>); &Directory_Search_ParmsDoc = &inDoc.AddDoc("Directory_Search_Parms"); &ret = &Directory_Search_ParmsDoc.AddValue("Host", <*>); &ret = &Directory_Search_ParmsDoc.AddValue("Port", <*>); &ret = &Directory_Search_ParmsDoc.AddValue("Base", <*>); &ret = &Directory_Search_ParmsDoc.AddValue("Scope", <*>); &ret = &Directory_Search_ParmsDoc.AddValue("Filter", <*>); /* ===> The following statement executes this instance: */ &EXECRSLT = &LDAP_SEARCHBI_1.Execute(); If ( &EXECRSLT <> 1 ) Then /* The instance failed to execute */ Else &outDoc = &LDAP_SEARCHBI_1.GetOutputDocs(""); &ret = &outDoc.GetValue("Distinguished_Name", <*>); &ret = &outDoc.GetValue("return_status", <*>); &ret = &outDoc.GetValue("return_status_msg", <*>); End-If; /* If NOT &RSLT ... */

See Also

Generating PeopleCode for a Business Interlink.

Parameters

Interlink. name

Specify the name of the Business Interlink definition from which to instantiate a Business Interlink object.

Returns

A Business Interlink object.

Example

The following example instantiates a Business Interlink object based on the Business Interlink definition QE_RP_SRAALL.

Local Interlink &SRA_ALL_1; &SRA_ALL_1 = GetInterlink(Interlink.QE_RP_SRAALL);

See Also

Business Interlink Class.

Business Interlinks documentation on Customer Connection

Click to jump to top of pageClick to jump to parent topicGetJavaClass

Syntax

GetJavaClass(ClassName)

Description

Use the GetJavaClass function to access a Java class so that you can manipulate it in PeopleCode. This is used for those classes that have static members, where it isn't appropriate to instantiate an object of the class. You can call only static methods, that is, class methods, with the object created with this function.

In Java, you access such static members of a class by using the class name:

result = java.class.name.SomeStaticMethod();

To do this in PeopleCode, do the following:

&Result = GetJavaClass("java.class.name").SomeStaticMethod();

Note. If you create a class that you want to call using GetJavaClass, it must be located in a directory specified in the PS_CLASSPATH environment variable.

Parameters

ClassName

Specify the name of an already existing class. This parameter takes a string value.

Returns

A JavaObject that refers to the named Java class.

Example

The Java class java.lang.reflect.Array has no public constructors and has only static methods. The methods are used to manipulate Java array objects. One of these static methods is GetInt:

public static int getInt(Object array, int index)

To use this method, get the class by using GetJavaClass. This code illustrates accessing the value of the fifth element of an integer array.

Local JavaObject &RefArray, &MyArray; . . . &RefArray = GetJavaClass("java.lang.reflect.Array"); . . . &MyArray = CreateJavaArray(“int[]”, 24); . . . &FifthElement = &RefArray.getInt(&MyArray, 4);

See Also

CreateJavaObject, CreateJavaArray.

Java Class

Click to jump to top of pageClick to jump to parent topicGetLevel0

Syntax

GetLevel0()

Description

Use the GetLevel0 function to create a rowset object that corresponds to level 0 of the component buffer. If used from PeopleCode that isn’t associated with a page, it returns the base rowset from the current context.

Parameters

GetLevel0 has no parameters. However, it does have a default method, GetRow, and a shortcut. Specifying GetLevel0()(1) is the equivalent of specifying GetLevel0().GetRow(1).

Returns

This function returns a rowset object that references the base rowset. For a component, this is the level 0 of the page. For a PeopleSoft Application Engine program, this is the state record rowset. For a message, this is the base rowset.

Note. You can also get the base rowset for a message using the GetRowset message class method, that is, &MSG.GetRowset().

Example

The following code sample returns the level one rowset.

Local Rowset &ROWSET; &ROWSET = GetLevel0().GetRow(1).GetRowset(SCROLL.LEVEL1_REC);

The following is equivalent to the previous example.

Local Rowset &ROWSET; &ROWSET = GetLevel0()(1).GetRowset(SCROLL.LEVEL1_REC);

To reference a level 2 rowset you would have code similar to this:

Local Rowset &ROWSET_LEVEL2, &ROWSET_LEVEL0, &ROWSET_LEVEL1; &ROWSET_LEVEL2 = GetLevel0().GetRow(1).GetRowset(SCROLL.LEVEL1_REC).GetRow(5). GetRowset(SCROLL.LEVEL2_REC); /* or */ &ROWSET_LEVEL0 = GetLevel0(); &ROWSET_LEVEL1 = &ROWSET_LEVEL0.GetRow(1).GetRowset(SCROLL.LEVEL1_REC); &ROWSET_LEVEL2 = &ROWSET_LEVEL1.GetRow(5).GetRowset(SCROLL.LEVEL2_REC); /* or */ &ROWSET_LEVEL2 = GetLevel0()(1).LEVEL1_REC(5).GetRowset(SCROLL.LEVEL2_REC);

See Also

GetRowset.

Rowset Class

Accessing the Data Buffer

Click to jump to top of pageClick to jump to parent topicGetMethodNames

Syntax

GetMethodNames(Type, Name)

Description

Use the GetMethodNames function to return either the method names for a Component Interface, or the function names of a WEBLIB record.

Parameters

Type

Specify the type of methods or functions you want returned. This parameter takes a string value. The values are:

  • WebLib

  • CompIntfc

Name

Specify the name of the Component Interface or WEBLIB record that you want to know the methods or functions for.

Returns

An array of string containing the method or function names.

Example

Local array of string &Array; &Array = GetMethodNames("CompIntfc", CompIntfc.USER_PROFILE); &Array = GetMethodNames("WebLib", Record.WEBLIB_PORTAL);

See Also

Component Interface Classes.

Web Libraries

Click to jump to top of pageClick to jump to parent topicGetMessage

Syntax

GetMessage()

Description

Use the GetMessage function to return a message.

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

It retrieves a message from the message queue for the current message being processed.

Note. The GetMessage function does not load the message with data. It always creates a new instance of a message object. You must use another method, such as GetRowset, to populate the message object. In addition, you must populate the message object with data before running any methods on it.

See Also

GetMessage

Parameters

None.

Returns

A reference to an empty message object if successful, NULL if not successful.

Example

Local message &MSG; &MSG = GetMessage();

See Also

CreateMessage.

GetRowset

Message Classes

Click to jump to top of pageClick to jump to parent topicGetMessageInstance

Syntax

GetMessageInstance(pub_id, pub_nodename, channelname)

Description

Use the GetMessageInstance function to get a message from the message queue.

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

Click to jump to top of pageClick to jump to parent topicGetMessageXmlDoc

Syntax

GetMessageXmlDoc()

Description

Use the GetMessageXmlDoc function in any of the messaging PeopleCode events.

Note. This function has been deprecated and remains for backward compatibility only. Use the Message class GetXMLDoc method instead.

It retrieves an XML message, either from the message queue for asynchronous messages, or in memory for synchronous messages, for the current message being processed. An XML message is a message that is unstructured, that is, isn't based on a record hierarchy. It creates and loads a data tree for the default message version, and returns NULL if not successful.

See Also

GetXmlDoc

Parameters

None.

Returns

A reference to an XmlDoc object if successful, NULL if not successful.

Example

The following example uses the GetMessageXmlDoc built-in function.

Local XmlDoc &BIGMAN; Local XmlNode &node, &root; Local string &outstring; Local Rowset &LEVEL0; Local Record &SALES_ORDER_INFO, &REC; &CRLF = Char(13) | Char(10); &BIGMAN = GetMessageXmlDoc(); &root = &BIGMAN.DocumentElement; &child_count = &root.ChildNodeCount; /* Get values out of XMLDoc */ &node_array = &root.GetElementsByTagName("QE_ACCT_ID"); &acct_id_node = &node_array.Get(2); &account_id_value = &acct_id_node.NodeValue; &node_array = &root.GetElementsByTagName("QE_ACCOUNT_NAME"); &acct_name_node = &node_array.Get(2); &account_name_value = &acct_name_node.NodeValue; &node_array = &root.GetElementsByTagName("QE_ADDRESS"); &address_node = &node_array.Get(2); &address_value = &address_node.NodeValue; &node_array = &root.GetElementsByTagName("QE_PHONE"); &phone_node = &node_array.Get(2); &phone_value = &phone_node.NodeValue; &outstring = "GetMessageXMLDoc Test"; &outstring = &outstring | &CRLF | &account_id_value | &CRLF | &account_name_value | &CRLF | &address_value | &CRLF | &phone_value; &SALES_ORDER_INFO = CreateRecord(Record.QE_SALES_ORDER); &SALES_ORDER_INFO.GetField(Field.QE_ACCT_ID).Value = &account_id_value; &SALES_ORDER_INFO.GetField(Field.DESCRLONG).Value = &outstring; &SALES_ORDER_INFO.Update();

See Also

PublishXmlDoc, SyncRequestXmlDoc.

XmlDoc Class

Message Classes

Click to jump to top of pageClick to jump to parent topicGetNextNumber

Syntax

GetNextNumber ({record.field | record_name, field_name}, max_number)

Description

Use the GetNextNumber function to increment the value in a record for the field you specify by one and returns that value. You might use this function to increment an employee ID field by one when you are adding a new employee. If the new value generated exceeds max_number, a negative value is returned and the field value isn't incremented.

The maximum value possible for max_number is 2147483647.

PeopleCode Event Considerations

Because this function results in a database update (specifically, UPDATE, INSERT, and DELETE) it should only be issued in the following events:

If you use this function in an event other than these, you need to ensure that the dataflow is correct and that you don't receive unexpected results.

GetNextNumber and GetNextNumberWithGapsCommit

The following is some of the differences between the two functions, to enable you to better chose which one is better for your application.

GetNextNumber

GetNextNumberWithGapsCommit

No AutoCommit (which can be a problem, as the table is locked until all Save events are finished.)

AutoCommit (this can be a performance enhancement as table is not locked as long).

 

Ability to use WHERE criteria for maintaining multiple sequence numbers in a single record.

 

Ability to increment by more than 1.

Allowed in SavePostChange

Can be used in any PeopleCode event.

Parameters

record.field

Specify the record and field identifiers for the field for which you want the new number. This is the recommended way to identify the field.

record_name

Specify as a string the name of the record containing the field for which you want the new number. This parameter with field_name was used prior to PeopleTools 8.

field_name

Specify as a string the name of the field for which you want the new number. This parameter with record_name was used prior to PeopleTools 8.

 

Note. If you use the older syntax (record_name, field_name), you have to manually update these two parameters in your programs whenever that record or field is renamed. The new syntax (record.field) is automatically updated, so you won't have to maintain it.

max_number

Specify the highest allowed value for the field you're incrementing. The maximum value possible for max_number is 2147483647.

Returns

A Number value equal to the highest value of the field specified plus one.

GetNextNumber returns an error if the value to be returned would be greater than max_number. The function returns one of the following:

Numeric Value

Constant Value

Description

Number

N/A 

The new number

-1

%GetNextNumber_SQLFailure

SQL failure

-2

%GetNextNumber_TooBig

Number too large, beyond max_number

-3

%GetNextNumber_NotFound

No number found, invalid data format

Example

If %Component = "RUN_AR33000" Then DUN_ID_NUM = GetNextNumber(INSTALLATION_AR.DUN_ID_NUM, 99999999); End-if;

The following uses the constant to check for the value returned:

&VALUE = GetNextNumber(INSTALLATION_AR.DUN_ID_NUM, 999); Evaluate &VALUE When = %GetNextNumber_SQLFailure /* do processing */ When = %GetNextNumber_TooBig /* do processing */ When = %GetNextNumber_NotFound /* Do processing */ When-other /* do other processing */ End-Evaluate;

See Also

GetNextNumberWithGaps.

Click to jump to top of pageClick to jump to parent topicGetNextNumberWithGaps

Syntax

GetNextNumberWithGaps(record.field, max_number, increment [, WHERE_Clause, paramlist])

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

var1 [, var2] ...

Description

Use the GetNextNumberWithGaps function to determine the highest value in a table for the field you specify, and return that value plus increment.

Note. This function has been deprecated and remains for backward compatibility only. Use the GetNextNumberWithGapsCommit function instead.

This function also enables you to specify a SQL WHERE clause as part of the function for maintaining multiple sequence numbers in a single record.

Note. GetNextNumberWithGaps also issues a COMMIT after incrementing the sequence number if no other database updates have occurred since the last COMMIT. This limits the time a database lock is held on the row and so may improve performance.

PeopleCode Event Considerations

Because this function results in a database update (specifically, UPDATE, INSERT, and DELETE) it should only be issued in the following events:

If you use this function in an event other than these, you need to ensure that the dataflow is correct and that you don't receive unexpected results.

Parameters

record.field

Specify the record and field identifiers for the field for which you want the new number. This is the recommended way to identify the field.

max_number

Specify the highest allowed value for the field you're incrementing. You can specify up to 31 digits for this value.

increment

Specify the value you want the numbers incremented by. You can specify up to 31 digits for this value.

WHERE_Clause

Specify a WHERE clause for maintaining multiple sequence numbers.

paramlist

Parameters for the WHERE clause.

Returns

A Number value equal to the highest value of the field specified plus one.

GetNextNumberWithGaps returns an error if the value to be returned would be greater than max_number. The function returns one of the following:

Numeric Value

Constant Value

Description

Number

N/A 

The new number

-1

%GetNextNumber_SQLFailure

SQL failure

-2

%GetNextNumber_TooBig

Number too large, beyond max_number

-3

%GetNextNumber_NotFound

No number found, invalid data format

Example

The following PeopleCode:

&greg = GetNextNumberWithGaps(GREG.DURATION_DAYS, 999999, 50, "where emplid = :1", 8001);

results in the following:

2-942 21.53.09 0.000 Cur#4.PTTST81B RC=0 Dur=0.000 Connect=PTTST81B/sa/ 2-943 21.53.09 0.000 Cur#4.PTTST81B RC=0 Dur=0.000 COM Stmt=UPDATE PS_GREG SET DURATION_DAYS = DURATION_DAYS + 50 where emplid = 8001 2-944 21.53.09 0.000 Cur#4.PTTST81B RC=0 Dur=0.000 EXE 2-945 21.53.09 0.000 Cur#4.PTTST81B RC=0 Dur=0.000 COM Stmt=SELECT DURATION_DAYS FROM PS_GREG where emplid = 8001 2-946 21.53.09 0.000 Cur#4.PTTST81B RC=0 Dur=0.000 EXE 2-947 21.53.09 0.000 Cur#4.PTTST81B RC=0 Dur=0.000 Fetch 2-948 21.53.09 0.010 Cur#4.PTTST81B RC=0 Dur=0.010 Commit 2-949 21.53.09 0.010 Cur#4.PTTST81B RC=0 Dur=0.010 Disconnect

See Also

GetNextNumber.

Click to jump to top of pageClick to jump to parent topicGetNextNumberWithGapsCommit

Syntax

GetNextNumberWithGapsCommit(record.field, max_number, increment [, WHERE_Clause, paramlist])

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

var1 [, var2] ...

Description

Use the GetNextNumberWithGapsCommit function to return the sequence number value plus increment for the given field residing in the given record. This function also enables you to specify a SQL Where clause as part of the function for maintaining multiple sequence numbers in a single record.

This function is typically used for obtaining a new sequence number for the application, for example, getting a new Purchase Order number to be used in the application transaction.

Use this function instead of the GetNextNumberWithGaps function. The GetNextNumberWithGaps function is very restrictive in its usage. The GetNextNumberWithGapsCommit function can be used in any event. The sequence number (record.field ) is incremented right away and it doesn't hold any database internal row lock beyond the execution of this function.

Note. A secondary database connection is used to increment and retrieve record.field. The default behavior is to keep the secondary database connection persistent in order to improve performance for the next GetNextNumberWithGapsCommit usage. If the database administrator finds the persistent connection too high an overhead for the production environment (which should not be the case since PeopleSoft uses application server to mulitplex the database connection), the database administrator can change the default behavior to use an on-demand connection method. The persistent second connection is disabled using DbFlags bit eight in the application server and process scheduler configuration files. The second connection can be completely disabled using DbFlags bit four in the application server and process scheduler configuration files

Considerations Using GetNextNumberWithGapsCommit

The following restrictions apply to the GetNextNumberWithGapsCommit function:

See Also

PSTOOLS Options

Parameters

record.field

Specify the record and field names for the field for which you want the new number. This is the recommended way to identify the field.

max_number

Specify the highest allowed value for the field you're incrementing. You can specify up to 31 digits for this value.

increment

Specify the value you want the numbers incremented by. You can specify up to 31 digits for this value.

WHERE_Clause

Specify a SQL Where clause for maintaining multiple sequence numbers.

paramlist

Specify the parameters for the SQL Where clause.

Returns

A number value equal to the highest value of the field specified plus one increment.

The GetNextNumberWithGapsCommit function returns an error if the value to be returned would be greater than max_number. The function returns one of the following:

Numeric Value

Constant Value

Description

Number

None

The new number

-1

%GetNextNumber_SQLFailure

SQL failure

-2

%GetNextNumber_TooBig

Number returned is too large, beyond max_number.

-3

%GetNextNumber_NotFound

No number found, invalid data format.

Example

The following PeopleCode increments the MCF_EMAIL_ID field by one and returns the new value, committing immediately.

&LAST_AUTO_NBR = GetNextNumberWithGapsCommit(MCF_INSTALL.MCF_EMAIL_ID, 2147483647, 1);

The above code produces output similar to the following:

1-192 10.39.54 0.320 Cur#2.1980.DB844901 RC=0 Dur=0.320 Connect=Secondry/DB844901/testdb2/ 1-193 10.39.54 0.000 GNNWGC ---- Successful obtain Second DB connection 1-194 10.39.54 0.010 Cur#2.1980.DB844901 RC=0 Dur=0.010 COM Stmt=UPDATE PS_MCF_INSTALL SET MCF_EMAIL_ID = MCF_EMAIL_ID + 1 1-195 10.39.54 0.000 Cur#2.1980.DB844901 RC=0 Dur=0.000 COM Stmt=SELECT MCF_EMAIL_ID FROM PS_MCF_INSTALL 1-196 10.39.54 0.000 Cur#2.1980.DB844901 RC=0 Dur=0.000 Commit 1-197 10.39.54 0.000 Cur#2.1980.DB844901 RC=0 Dur=0.000 Disconnect

See Also

GetNextNumber

Click to jump to top of pageClick to jump to parent topicGetNextProcessInstance

Syntax

GetNextProcessInstance([Commit])

Description

Use the GetNextProcessInstance function to retrieve the next available process instance from the Process Scheduler System table. When determining to find the next process instance in the sequence, the function ensures the next available process instance does not exist in both the Process Request and Message Log tables.

By default, the function commits the changes to the Process Scheduler System table to set it to the next available process instance for the next available request. If this function is called within a PeopleCode function where issuing a COMMIT to the database destroys a unit of work, specify "0" for Commit.

Parameters

Commit

Specify whether the current data instance should be committed to the database. This parameter takes a string value: "1", commit the data, "0", do not commit the data. "1" is the default value.

Returns

Return a number: 0 if successful, 1 if the system detected an error retrieving the next available process instance.

See Also

ProcessRequest Class.

Click to jump to top of pageClick to jump to parent topicGetNRXmlDoc

Syntax

GetNRXmlDoc(NRID, EntityName)

Description

Use the GetNRXmlDoc function in any of the messaging PeopleCode events. It retrieves an XML message, categorized as non-repudiation, from the message queue for the specified non-repudiation ID. An XML message is a message that is unstructured, that is, isn't based on a record hierarchy. It creates and loads a data tree for the default message version, and returns Null if not successful.

Parameters

NRID

Specify the non-repudiation ID for the XML message that you want to retrieve. This parameter takes a numeric value.

EntityName

Specify the name of the entity that signed the data, as a string. For Peoplesoft, this is the node name.

Returns

A reference to an XmlDoc object if successful, Null if not successful.

See Also

XmlDoc Class

Click to jump to top of pageClick to jump to parent topicGetPage

Syntax

GetPage(PAGE.pagename)

Description

Use the GetPage function to return a reference to a page object. Generally, page objects are used to hide or unhide pages in a component.

Generally, the PeopleCode used to manipulate a page object would be associated with PeopleCode in the Activate event.

Note. The page object shouldn’t be used until after the Component Processor has loaded the page: that is, don’t instantiate this object in RowInit PeopleCode, use it in PostBuild or Activate instead.

Note

An expression of the form

PAGE.name.property

is equivalent to GetPage(name).property.

Parameters

PAGE. pagename

The name of the page for which you want to create an object reference. Must be a page in the current context.

Returns

A page object that references the page.

Example

In the following example, a page is hidden based on the value of the current field.

If PAYROLE_TYPE = "Global" Then GetPage(PAGE.JOB_EARNINGS).Visible = False; End-If;

See Also

Page Class.

Understanding Current Context

Click to jump to top of pageClick to jump to parent topicGetProgramFunctionInfo

Syntax

GetProgramFunctionInfo(ProgramId)

Where ProgramId is the following for PeopleCode user-defined functions:

RECORD.RecordName.FIELD.FieldName.METHOD.MethodName

Where ProgramId is the following for Component Interface user-defined methods:

COMPONENTINTERFACE.CIName.METHODS.Methods

Description

Use the GetProgramFunctionInfo function to determine the full signature and return values of a PeopleCode user-defined function, or a Component Interface method.

Considerations Using Component Interfaces

Component Interfaces only support type conversion of primitive data types back and forth between PeopleCode values and those using inside Component Interface processing.

Component Interface processing traps all errors that occur inside the invocation of the Component Interface and on failure simply returns a false value.

Parameters

ProgramId

Specify the full name of the function or the Component Interface method, as a string.

Returns

An array of array of any.

There is one array for every function or method defined in the program. Each array contains the following information:

  1. The name of the function.

  2. The signature of the parameters as a comma-separated string (see additional information below.)

  3. The signature of the result (see result list below.)

  4. The annotation of the Doc tag.

  5. A boolean indicator of whether this function is to be exported (as indicated by the noexp tag).

  6. A boolean indicator of whether this function is permitted to be called by this user. This only makes sense for Functions defined as CI methods in Component Interface PeopleCode. The default value is true.

The parameters may be modified by the following values:

Value

Description

?

An optional parameter.

*

A repeated parameter.

&

A parameter reference (PARM_NAME)

The possibly values of the result are as follows. Note the use of both lower and upper case letters.

Value

Description

D

Dec

d

Date

S

String

A

Any

B

Boolean

V

None

t

Time

T

DateTime

I

Image

i

Integer

O

Object

f

Float

9

Number

x

Unknown

[<value>

Array

A single bracket indicates a single array. Two brackets indicates a two-dimensional array, three brackets a three-dimensional array, and so on.

The value following the bracket indicates the type of array. For example, [i indicates an array of integer, [[S indicates an array of array of string.

Example

In the following example, this code is associated with the record QE_ABSENCE_HIST, on the field QE_REASON, in the FieldChange event.

Function Update(&1 As string) Returns number NoExport Doc "this is some attached annotation" Return 1.23; End-Function; /* everything else . . */

The following PeopleCode program:

Local array of array of any &r; &r = GetProgramFunctionInfo("RECORD.QE_ABSENCE_HIST.FIELD.QE_REASON.METHOD.FieldChange");

Returns a two-dimensional array with a single row that contains the following:

&r[1][1] – the name of the function “Update”

&r[1][2] – the signature of the parameter “S&”

&r[1][3] – the signature of the result “9”

&r[1][4] – the annotation of the doc tag “this is some attached annotation”

&r[1][5] – a boolean indicator of whether this function is to be exported. In this case it returns false.

The following example is used with a Component Interface program:

Function Update(&1 As string) Returns number NoExport Doc "this is some attached annotation" Return 1.23; End-Function; Function Updateagain(&1 As string) Returns number Doc "this is some more attached annotation" Return 1.23; End-Function; Local File &log; Function LogText(&msg As string) If &log = Null Then Return End-If; &log.WriteLine(&msg); End-Function; Function CreateCI(&Name As string) Returns ApiObject Local ApiObject &CI; /** Get Component Interface **/ &CI = %Session.GetCompIntfc(@("CompIntfc." | &Name)); /* instantiate */ &CI.PROCESSNAME = "AEMINITEST"; &CI.PROCESSTYPE = "Application Engine"; &CI.RUNCONTROLID = 99; &CI.Create(); Return &CI; End-Function; Function DisplayProgramFuncInfo(&r As array of array of any) Local integer &i; For &i = 1 To &r.Len Local string &o; &o = &r [&i][1] | "(" | &r [&i][2] | ";" | &r [&i][3] | ") doc '" | &r [&i][4] | "'"; If &r [&i][5] = 0 Then &o = &o | " noexport "; Else &o = &o | " export "; End-If; If &r [&i][6] = 0 Then &o = &o | " no permission "; Else &o = &o | " permitted "; End-If; LogText(&o); End-For; End-Function; Function SetupParameters(&Names As array of string, &Sigs As array of string) Returns array of any Local array of any &p = CreateArrayAny(); Local integer &i; /* could use the parameter name to get values out of a dom?? */ /* Base types we could handle // D = Dec // S = String // d = Date // A = Any // B = Boolean // V = None // t = Time // T = DateTime // I = Image // O = Object // i = Integer // f = Float // 9 = Number // x = Unknown */ For &i = 1 To &Sigs.Len Local string &parName = RTrim(LTrim(&Names [&i + 1])); /* first name is create/get/?? */ /* Here is where you'd get the value for this particular parameter and then push it properly onto the parameter array */ Evaluate Substring(&Sigs [&i], 1, 1) When = "D" &p.Push(1); Break; When = "S" &p.Push("String for " | &parName); Break; When = "9" When = "i" &p.Push(&i); Break; When-Other &p.Push("Unimplemented . . ."); End-Evaluate End-For; Return &p; End-Function; Function CallUDMMethod(&ci As ApiObject, &funcInfo As array of array of any, &methodName As string) Returns any /* an example of calling a user defined method on a ci */ /* 1. find it in the funcinfo */ Local integer &i = 1; Local integer &nFuncs = &funcInfo.Len; While &i <= &nFuncs /* name should match and it should be exportable (the default) and the doc tag should have something in it and it should be permitted */ If &funcInfo [&i][1] = &methodName And &funcInfo [&i][5] <> 0 And Len(&funcInfo [&i][4]) > 0 And &funcInfo [&i][6] <> 0 Then Break; End-If; &i = &i + 1; End-While; If &i > &nFuncs Then LogText("not found"); Return False; End-If; /* 2. Next get the info necessary to call the function based on the signature info */ Local string &parSignatures = &funcInfo [&i][2]; Local boolean &bPars = False; Local array of any &Pars; If Len(&parSignatures) > 0 Then &bPars = True; Local array of string &parSignature = Split(&parSignatures, ","); Local array of string &parNames = Split(&funcInfo [&i][4], ","); /* first one should be Create/get/? */ /* number of parameters should match number of parameter names */ If &parSignature.Len <> &parNames.Len - 1 Then LogText("length mismatch"); Return False; End-If; &Pars = SetupParameters(&parNames, &parSignature); Else &Pars = CreateArrayAny(); End-If; /* 3. Call the udm method with our parameters */ Return &ci.InvokeMethodUDF(&methodName, &Pars); End-Function; QE_ABSENCE_HIST.QE_REASON.Value = ""; /* clean it up */ Local string &ciName = "PROCESSREQUEST"; Local ApiObject &CI = CreateCI(&ciName); Local array of any &pars = CreateArrayAny("First parameter", 2); /* check with variable for method name */ Local string &methodname = "FoxTest"; /* add in a bogus parameter - tested - works - fails with false return :-( as per usual in api objects*/ Local string &bogus = "bogus par"; &log = GetFile("C:\temp\junk\udflog.txt", "a", %FilePath_Absolute); LogText("====================================="); LogText("Result of direct call: " | &CI.InvokeMethodUDF(&methodname, &pars /* , &bogus */)); rem LogText("&ci: " | &CI); /* do this the new way - at least model how a webservices Peoplecode implementation could do it */ Local string &ciObjid = "COMPONENTINTERFACE." | &ciName | ".METHOD.Methods"; /* get the program information */ Local array of array of any &progInfo; &progInfo = GetProgramFunctionInfo(&ciObjid); /* returns a an array of arrays: an array for each function defined in the program. Each row has the following ([i] = position i): [1] = program name (string) [2] = comma separated list of parameter signatures (string) [3] = result signature (string) [4] = text that was with the doc tag. Convention here is a comma separated list of values: first item is one of either Create or Get, specifying what method has to be called first second and subsequent items are the names of the parameters (this information is not obtainable from the program information. These are the names to be exposed as the web service parameter names e.g. the above function would have a doc like "Create, StringParameter, NumericParameter" [5] = an integer setting: 0=no export and 1=export (the default) [6] = an integer setting indicating the permission for user to call this (only applies to CI programs) 0=no permission and 1=permitted (the default) */ DisplayProgramFuncInfo(&progInfo); If &CI = Null Then &CI = CreateCI(&ciName); End-If; LogText("Result of indirect call: " | CallUDMMethod(&CI, &progInfo, &methodname));

See Also

Component Interface Classes

Click to jump to top of pageClick to jump to parent topicGetPubContractInstance

Syntax

GetPubContractInstance(pub_id, pub_nodename, channelname, sub_nodename)

Description

Note. This function is no longer available. It has been replaced with the GetPubXmlDoc function.

See GetPubXmlDoc.

Click to jump to top of pageClick to jump to parent topicGetPubHeaderXmlDoc

Syntax

GetPubHeaderXmlDoc(PubID, PubNode, ChannelName, VersionName[, Segment])

Description

Use the GetPubHeaderXmlDoc function to retrieve the message header from the message queue.

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

The message header, also known as the message instance, is the published message before any transformations were performed.

Note. This function should not be used in standard message processing. It should only be used when correcting or debugging a publication contract that is in error.

See Also

GetMessage

Parameters

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.

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 reference to an XmlDoc object if successful, NULL if not successful.

See Also

ReSubmitPubHeaderXmlDoc, GetPubXmlDoc.

Click to jump to top of pageClick to jump to parent topicGetPubXmlDoc

Syntax

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

Description

Use the GetPubXmlDoc function to retrieve a message from the message queue.

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

This is the message after any transformations have been preformed. It creates and loads a data tree for the specified message version, and returns NULL if not successful. This function is used for publication contract error correction when the error correction process needs to fetch a particular message instance for the publication contract in error. SQL on the Publication Contract table is used to retrieve the key fields.

Note. This function should not be used in standard message processing. It should only be used when correcting or debugging a publication contract that is in error.

See Also

GetMessage

Parameters

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 reference to an XmlDoc object if successful, NULL if not successful.

See Also

ReSubmitPubXmlDoc, ReSubmitPubHeaderXmlDoc.

Click to jump to top of pageClick to jump to parent topicGetRecord

Syntax

GetRecord([RECORD.recname])

Description

Use the GetRecord function to create a reference to a record object for the current context, that is, from the row containing the currently executing program.

The following code:

&REC = GetRecord();

is equivalent to:

&REC = GetRow().GetRecord(Record.recname);

or

&REC = GetRow().recname;

Note. This function is invalid for PeopleCode programs located in events that aren't associated with a specific row and record at the point of execution. That is, you cannot use this function in PeopleCode programs on events associated with high-level objects like pages (the Activate event) or components (component events).

Parameters

With no parameters, this function returns a record object for the current context (the record containing the program that is running).

If a parameter is given, RECORD. recname must specify a record in the current row.

Returns

GetRecord returns a record object.

Example

In the following example, the level 2 rowset (scroll) has two records: EMPL_CHKLST_ITM, (the primary record) and CHKLST_ITM_TBL. If the code is running from a field on the EMPL_CHKLST_ITM record, the following returns a reference to that record:

&REC = GetRecord(); /*returns primary record */

The following returns the other record in the current row.

&REC2 = GetRecord(RECORD.CHKLST_ITM_TBL);

The following event uses the @ symbol to convert a record name that’s been passed in as a string to a component name.

Function set_sub_event_info(&REC As Record, &NAME As string) &FLAGS = CreateRecord(RECORD.DR_LINE_FLG_SBR); &REC.CopyFieldsTo(&FLAGS); &INFO = GetRecord(@("RECORD." | &NAME)); If All(&INFO) Then &FLAGS.CopyFieldsTo(&INFO); End-If; End-Function;

See Also

CreateRecord.

Message Classes

Accessing the Data Buffer

Understanding Current Context

Click to jump to top of pageClick to jump to parent topicGetRelField

Syntax

GetRelField(ctrl_field, related_field)

Description

Use the GetRelField function to retrieve the value of a related display field and returns it as an unspecified (Any) data type.

Note. This function remains for backward compatibility only. Use the GetRelated field class method instead.

The field ctrl_field specifies the display control field, and related_field specifies the name of the related display field whose value is to be retrieved. In most cases, you could get the value of the field by referencing it directly. However, there are two instances where GetRelField can be useful:

See GetRelated.

Using GetRelField With a Control Field

PeopleCode events on the Control Field can be triggered by the Related Edit field. When this happens, there can be different behavior than with other types of fields:

Example

In the following example, there are two related display fields in the page bound to PERSONAL_DATA.NAME. One is controlled by the EMPLID field of the high-level key, the other controlled by an editable DERIVED/WORK field in which the user can enter a new value. Use GetRelField to get the value of the related display controlled by EMPLID.

/* Use a related display of a required non-default field to verify * that the new Employee Id is not already in use */ If GetRelField(EMPLID, PERSONAL_DATA.NAME) <> "" Then Error MsgGet(1000, 65, "New Employee ID is already in use. Please reenter."); End-If;

See Also

Accessing the Data Buffer.

Click to jump to top of pageClick to jump to parent topicGetRow

Syntax

GetRow()

Description

Use the GetRow function to obtain a row object for the current context, that is the row containing the currently executing program.

Using the GetRow function is equivalent to:

&ROW = GetRowset().GetRow(CurrentRowNumber());

Note. For PeopleCode programs located in events that are not associated with a specific row at the point of execution, this function is invalid. That is, you cannot use this function in PeopleCode programs on events associated with high-level objects like pages or components.

Parameters

None.

Returns

GetRow returns a row object that references the current row in the component buffers. If the program is not being run from a page (such as from PeopleSoft Application Engine, or as part of a Message program) it references that data.

Example

Local Row &ROW; &ROW = GetRow();

See Also

GetRowset.

Row Class

Understanding Current Context

Click to jump to top of pageClick to jump to parent topicGetRowset

Syntax

GetRowset([SCROLL.scrollname])

Description

Use the GetRowset function to get a rowset object based on the current context. That is, the rowset is determined from the row containing the program that is running.

Syntax Format Considerations

An expression of the form

RECORD.scrollname.property

or

RECORD.scrollname.method(. . .)

is converted to an object expression by using GetRowset(SCROLL. scrollname).

Parameters

If a parameter is specified, it must be the name of the primary record for the scroll that is a child of the current context.

Returns

With no parameters, GetRowset returns a rowset object for the rowset containing the currently running program. If a parameter is specified, it returns a rowset for that child scroll. scrollname must be the name of the primary record for the scroll.

Example

In the following example, RS1 is a level 1 rowset, and RS2 is a child rowset of RS1.

Local Rowset &RS1, &RS2; &RS1 = GetRowset(); &RS2 = GetRowset(SCROLL.EMPL_CHKLST_ITM);

See Also

GetLevel0.

Rowset Class

Understanding Current Context

Click to jump to top of pageClick to jump to parent topicGetRowsetCache

Syntax

GetRowsetCache([Rowset.]name)

Description

Use GetRowsetCache to return the existing rowset cache with the given name.

Note. This function returns a RowsetCache object, not a rowset object. You must use the Get RowsetCache method in order to convert a RowsetCache object into a rowset object.

Every time you use the GetRowsetCache function, you should verify that the function executed successfully by testing for a null object. For example:

Local RowsetCache &RSC; &RSC = GetRowsetCache(Rowset.MyRowset); If All(&RSC) Then /* do processing */ Else /* call to populate rowset cache */ End-if;

Parameters

Record. name

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

Returns

A RowsetCache object populated with the rowset cache instance specified.

Example

&Cache1 = GetRowsetCache("AAROWSET1");

See Also

CreateRowsetCache

RowsetCache Class

Click to jump to top of pageClick to jump to parent topicGetSelectedTreeNode

Syntax

GetSelectedTreeNode(RECORD.recordname)

Description

Use the GetSelectedTreeNode function to determine what node the user has selected in a dynamic tree control.

Note. Dynamic tree controls have been deprecated. Use the GenerateTree function or Tree Viewer.

See Also

GenerateTree.

Viewing Trees From Application Pages

Click to jump to top of pageClick to jump to parent topicGetSession

Syntax

GetSession()

Description

Use the GetSession function to retrieve a PeopleSoft session object.

After you use GetSession, you can instantiate many other types of objects, like Component Interfaces, data trees, and so on.

After you use GetSession you must connect to the system using the Connect property.

If you are connecting to the existing session and not doing additional error checking, you may want to use the %Session system variable instead of GetSession. %Session returns a connection to the existing session.

Parameters

None.

Returns

A PeopleSoft session object.

Example

Local ApiObject &MYSESSION; &MYSESSION = GetSession();

See Also

Component Interface Classes.

PortalRegistry Classes

Query Classes

Search Classes

Session Class

Tree Classes

%Session

Click to jump to top of pageClick to jump to parent topicGetSetId

Syntax

GetSetId({FIELD.fieldname | text_fieldname}, set_ctrl_fieldvalue, {RECORD.recname | text_recname}, treename)

Description

Use the GetSetId function to return a string containing a setID based on a set control field (usually BUSINESS_UNIT), a set control value, and one of the following:

If you want to pass a control record name to the function, you must pass an empty string in the treename parameter. Conversely, if you want to pass a tree name, you must pass an empty string in the text_recname parameter. In practice, tree names are rarely used in this function.

Note. This function does not validate the parameters passed to it. It is up to your application to ensure that only valid data is used. If an invalid value is used, the defined default value is used.

Parameters

fieldname

Specify the set control field name as a FIELD reference. Use this parameter (recommended) or the text_fieldname parameter.

text_fieldname

Specify the name of the set control field as a string. Use this parameter or the fieldname parameter.

set_ctrl_fieldvalue

Specify the value of the set control field as a string.

recname

Specify as a RECORD reference the name of the control record belonging to the record group for which you want to obtain the setID corresponding to the set control value. Use this parameter (recommended) or the text_recname parameter.

text_recname

Specify as a string the name of the control record belonging to the record group for which you want to obtain the setID corresponding to the set control field value. Use this parameter or the recname parameter.

treename

Specify as a string the name of the tree for which you want to obtain the setID corresponding to the set control field value.

Returns

GetSetId returns a five-character setID string.

Example

In this example, BUSINESS_UNIT is the Set Control Field, and PAY_TRMS_TBL is a control table belonging to a record group controlled by the current value of BUSINESS_UNIT. The function returns the setID for the record group.

&SETID = GetSetId(FIELD.BUSINESS_UNIT, &SET_CTRL_VAL, RECORD.PAY_TRMS_TBL, "");

See Also

Control Tables.

Click to jump to top of pageClick to jump to parent topicGetSQL

Syntax

GetSQL(SQL.sqlname [, paramlist])

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

inval1 [, inval2] ...

Description

Use the GetSQL function to instantiate a SQL object and associates it with the SQL definition specified by sqlname. The SQL definition must already exist, either created using PeopleSoft Application Designer or the StoreSQL function.

Processing of the SQL definition is the same as for a SQL statement created by the CreateSQL function.

Setting Data Fields to Null

This function does not set Component Processor data buffer fields to NULL after a row not found fetching error. However, it does set fields that aren’t part of the Component Processor data buffers to NULL.

Using Arrays With paramlist

You can use a parameter of type "Array of Any" in place of a list of bind values. This is primarily used when you don't know the number of values being supplied until the code runs.

For example, suppose you had a SQL definition INSERT_TEST, that had PeopleCode that dynamically (that is, at runtime) generated the following SQL statement:

"INSERT INTO PS_TESTREC (TESTF1, TESTF2, TESTF3, TESTF4, . . .TESTN) VALUES (:1, :2, %DateTimeIn(:3), %TextIn(:4). . .N)";

Suppose you have placed the values to be inserted into an Array of Any, say &AAny:

&AAny = CreateArrayAny("a", 1, %DateTime, "abcdefg", . . .N);

You can execute the insert by:

GetSQL(SQL.INSERT_TEST, &AAny);

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

SQL.sqlname

Specify the name of a SQL definition.

paramlist

Specify input values for the SQL string.

Returns

A SQL object.

Example

The following code creates and opens an SQL object on the SQL definition stored as ABCD_XY (for the current market, database type and as of date). It binds the given input values, and executes the statement. If the SQL.ABCD is a SELECT, this should be followed by a series of Fetch method calls.

&SQL = GetSQL(SQL.ABCD_XY, ABSENCE_HIST, &EMPLID);

The following is a generic function that can be called from multiple places to retrieve a specific record using the SQL Objects.

Local SQL &SQL; Local string &SETID, &TEMPLATE; Local date &EFFDT; Function FTP_GET_TEMPLATE(&REC As Record) Returns Boolean ; &TEMPLATE = FTP_RULE_TEMPLATE; &EFFDT = EFFDT; &SETID = SETID; &SQL = GetSQL(SQL.FTP_TEMPLATE_SELECT, &SETID, &TEMPLATE, &EFFDT); If &SQL.Status = 0 Then If &SQL.Fetch(&REC) Then &SQL.Close(); Return True; End-If; Else &TITLE = MsgGet(10640, 24, "SQL Error"); MessageBox(64, &TITLE, 10640, 23, "SQL Object Not Found in SQL", SQL.FTP_TEMPLATE_SELECT); End-If; &SQL.Close(); Return False; End-Function;

The SQL definition FTP_TEMPLATE_SELECT has the following code. Note that it uses the %List and %EFFDTCHECK meta-SQL statements. This makes the code easier to maintain: if there are any changes to the underlying record structure, this SQL definition won’t have to change:

SELECT %List(FIELD_LIST,FTP_DEFAULT_TBL A) FROM PS_FTP_TEMPLATE_TBL A WHERE A.SETID = :1 AND A.FTP_RULE_TEMPLATE = :2 AND %EFFDTCHECK(FTP_DEFAULT_TBL A1,A,:3) AND A.EFF_STATUS = 'A'

See Also

CreateSQL, DeleteSQL, FetchSQL, SQLExec.

SQL Class

Open

Click to jump to top of pageClick to jump to parent topicGetStoredFormat

Syntax

GetStoredFormat(scrollpath, target_row, [recordname.]fieldname)

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 GetStoredFormat function to return the name of a field’s custom stored format.

Note. This function remains for backward compatibility only. Use the StoredFormat field class property instead.

To return the format for a field on level zero of the page, pass 1 in target_row.

See Also

StoredFormat.

Accessing the Data Buffer

Parameters

scrollpath

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

target_row

An integer specifying the row of the target field. If you are testing a field on level zero, pass 1 in this parameter.

[recordname .]fieldname

The name of the field from which to get the stored format name. The field can be on any level of the active page. The recordname prefix is required if the call to GetStoredFormat is in a record definition other than recordname.

Returns

Returns a String equal to the name of the stored custom format for the field.

Example

This example returns a string containing the custom format for postal codes on level zero of the page or on the current row of scroll level one. This function is called in the RowInit event, so no looping is necessary.

Function get_postal_format() Returns string &CURR_LEVEL = CurrentLevelNumber(); Evaluate &CURR_LEVEL When = 0 &FORMAT = GetStoredFormat(POSTAL, 1); When = 1 &FORMAT = GetStoredFormat(POSTAL, CurrentRowNumber(1)); End-Evaluate; Return (&FORMAT); End-Function;

See Also

SetDisplayFormat.

Specifying Data with References Using Scroll Path Syntax and Dot Notation

Click to jump to top of pageClick to jump to parent topicGetSubContractInstance

Syntax

GetSubContractInstance(pub_id, pub_nodename, channelname, messagename, sub_name)

Description

Note. This function is no longer available. It has been replaced with the GetSubXmlDoc function.

See GetSubXmlDoc.

Click to jump to top of pageClick to jump to parent topicGetSubXmlDoc

Syntax

GetSubXmlDoc(PubID, PubNode, ChannelName, VersionName, MessageName[, Segment])

Description

Use the GetSubXmlDoc function to retrieve a message from the message queue.

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

It creates and loads a data tree for the specified message version, and returns NULL if not successful. This function is used for subscription contract error correction, when the error correction process needs to fetch a particular message instance for the subscription contract in error. SQL on the Subscription Contract table is used to retrieve the key fields.

Note. This function should not be used in standard message processing. It should only be used when correcting or debugging a subscription contract that is in error.

See Also

GetMessage

Parameters

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.

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 reference to an XmlDoc object if successful, NULL if not successful.

See Also

ReSubmitSubXmlDoc.

Click to jump to top of pageClick to jump to parent topicGetSyncLogData

Syntax

GetSyncLogData(GUID, pubnode, chnlname, msg_name, logtype [, message_version])

Description

Use the GetSyncLogData to return a log containing information about the specified synchronous message.

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

You can use this information for debugging. Using this function, you can obtain the request and response data in a synchronous request, both pre- and post-transformation.

This function is used in the PeopleCode for the Message Monitor.

See Also

GetSyncLogData

Parameters

GUID

Specify the GUID for the published synchronous message as a string. This property is populated after the message is sent.

pubnode

Specify the name of the node that the synchronous message was published from as a string.

chnlname

Specify the name of the channel the synchronous message was published to as a string.

msg_name

Specify the message definition name that you want to retrieve log data from as a string.

Log_type

Specify the type of log data you want to obtain, as a number. Values are:

1: the original request

2: the transformed request

3: the original response

4: the transformed response

message_version

Specify the message version name as a string.

Returns

An XML string containing the log data.

Example

Local String &guid, &pubnode, &channel, &msg_name; Local Number &log_type; .. .. &descrlong = GetSyncLogData(&guid, &pubnode, &channel, &msg_name, &log_type);

See Also

Using the Service Operations Monitor.

Click to jump to top of pageClick to jump to parent topicGetTreeNodeParent

Syntax

GetTreeNodeParent(node)

Description

Use the GetTreeNodeParent function to access data from dynamic tree controls.

Note. Dynamic tree controls have been deprecated. Use the GenerateTree function or Tree Viewer.

See Also

GenerateTree.

Viewing Trees From Application Pages

Click to jump to top of pageClick to jump to parent topicGetTreeNodeRecordName

Syntax

GetTreeNodeRecordName(node)

Description

Use the GetTreeNodeRecordName function in accessing data from dynamic tree controls.

Note. Dynamic tree controls have been deprecated. Use the GenerateTree function or Tree Viewer.

See Also

GenerateTree.

Viewing Trees From Application Pages

Click to jump to top of pageClick to jump to parent topicGetTreeNodeValue

Syntax

GetTreeNodeValue(node, [recordname.]fieldname)

Description

Use the GetTreeNodeValue function in accessing data from dynamic tree controls.

Note. Dynamic tree controls have been deprecated. Use the GenerateTree function or Tree Viewer.

See Also

GenerateTree.

Viewing Trees From Application Pages

Click to jump to top of pageClick to jump to parent topicGetURL

Syntax

GetURL(URL.URLIdentifier)

Description

Use the GetURL function to return the URL, as a string, for the specified URLIdentifier. The URLIdentifier must exist and been created using URL Maintenance.

Note. If the URL identifier contains spaces, you must use quotation marks around URLIdentifier. For example, GetURL(URL."My URL");

If a language-specific URL exists for the user's current session language, and the user is not calling GetURL from a batch program, it is returned. Otherwise, the base language version of the URL is returned.

When GetURL is called from an application engine program, the URL is retrieved either from the base URL table or the related language table depending on the language code. The language code is provided by the User Profile for the user that executed the application engine program. The language code does not come from the language that the user specified when logging into the system.

Parameters

URLIdentifier

Specify a URL Identifier for a URL that already exists and was created using the URL Maintenance page.

Returns

A string containing the URL value for that URL Identifier, using the user's language preference.

Example

Suppose you have a URL with the identifier PEOPLESOFT, and the following URL:

http://www.peoplesoft.com

From the following code example

&PS_URL = GetURL(URL.PEOPLESOFT);

&PS_URL has the following value:

http://www.peoplesoft.com

Suppose you have the following URL stored in the URL Maintenance, with the name QE_CALL:

/S/WEBLIB_QE_MCD.QE_MCD_MAIN.FieldFormula.iScript_Call

You could combine this in the following code to produce an HTML string used as part of a response:

&output = GetHTMLText(HTML.QE_PHONELIST, %Request.RequestURI | "?" | GetURL(URL.QE_CALL));

See Also

ViewURL.

URL Maintenance

Click to jump to top of pageClick to jump to parent topicGetUserOption

Syntax

GetUserOption(Level, OPTN)

Description

Use the GetUserOption function to return the default value for the specified option.

Parameters

Level

Specify the option category level as a string.

OPTN

Specify the option as a string.

Returns

The default value for the specified option.

Example

Local Any &MyValue; &MyValue = GetUserOption("PPLT", "TZONE");

See Also

SetUserOption.

Managing PeopleSoft Personalizations

Click to jump to top of pageClick to jump to parent topicGetWLFieldValue

Syntax

GetWLFieldValue(fieldname)

Description

When the user has opened a page from a Worklist (by selecting one of the work items) use the GetWLFieldValue function to retrieve the value of a field from the current row of the application Worklist record. You can use the %WLName system variable to check whether the page was accessed from a Worklist.

Returns

Returns the value of a specified field in the Worklist record as an Any data type.

Example

This example, from RowInit PeopleCode, populates page fields with values from the Worklist record. The %WLName system variable is used to determine whether there is a currently active Worklist (that is, whether the user accessed the page using a Worklist).

&WL = %WLName; If &WL > " " Then &TEMP_NAME = "ORDER_NO"; ORDER_NO = GetWLFieldValue(&TEMP_NAME); &TEMP_NAME = "BUSINESS_UNIT"; BUSINESS_UNIT = GetWLFieldValue(&TEMP_NAME); &TEMP_NAME = "SCHED_Date"; &SCHED_Date = GetWLFieldValue(&TEMP_NAME); SCHED_Date = &SCHED_Date; &TEMP_NAME = "DEMAND_STATUS"; DEMAND_STATUS = GetWLFieldValue(&TEMP_NAME); End-If;

See Also

MarkWLItemWorked, TriggerBusinessEvent.

%WLName

Click to jump to top of pageClick to jump to parent topicGlobal

Syntax

Global data_type &var_name

Description

Use the Global statement to declare PeopleCode global variables. A global variable, once declared in any PeopleCode program, remains in scope throughout the PeopleSoft session. The variable must be declared with the Global statement in any PeopleCode program in which it is used.

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

Not all PeopleCode data types can be declared as Global. For example, ApiObject data types can only be declared as Local.

Parameters

data_type

Specify a PeopleCode data type.

&var_name

A legal variable name.

Example

The following example declares a global variable and then assigns it the value of a field:

global string &AE_APPL_ID; &AE_APPL_ID = AE_APPL_ID;

See Also

Local, Component.

Data Types

Click to jump to top of pageClick to jump to parent topicGray

Syntax

Gray(scrollpath, target_row, [recordname.]fieldname)

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.

If you put the function on the same scroll level as the field being changed, you can use the following syntax:

Gray(Fieldname)

The more complex syntax can be used to loop through a scroll on a lower level than the PeopleCode program.

Description

Use the Gray function to make a field unavailable for entry a page field, preventing the user from making changes to the field.

Note. This function remains for backward compatibility only. Use the Enabled field class property instead.

Gray makes a field display-only, while Hide makes it invisible. You can undo these effects using the built-in functions Ungray and Unhide.

Note. If you specify a field as Display Only in PeopleSoft Application Designer, using the PeopleCode functions Gray, followed by Ungray, will not make it editable. This function shouldn't be used in any event prior to RowInit.

See Also

Enabled.

Accessing the Data Buffer

Specifying Data with References Using Scroll Path Syntax and Dot Notation

Parameters

scrollpath

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

target_row

An integer specifying the row on the target scroll level where the referenced buffer field is located.

[recordname .]fieldname

The name of the field to gray. The field can be on scroll level one, two, or three of the active page. The recordname prefix is required if the call to Gray is in a record definition other than recordname.

Returns

Optionally returns a Boolean value indicating whether the function succeeded.

Example

This example, which would typically be found in the RowInit event, disables the page’s address fields if the value of the SAME_ADDRESS_EMPL field is "Y".

If SAME_ADDRESS_EMPL = "Y" Then Gray(STREET1); Gray(STREET2); Gray(CITY); Gray(STATE); Gray(ZIP); Gray(COUNTRY); Gray(HOME_PHONE); End-if;

See Also

Hide, Ungray, Unhide.

Click to jump to top of pageClick to jump to parent topicGrayMenuItem

Syntax

GrayMenuItem(BARNAME.menubar_name, ITEMNAME.menuitem_name)

Description

Note. The GrayMenuItem function is supported for compatibility with previous releases of PeopleTools. New applications should use DisableMenuItem instead.

See Also

DisableMenuItem.

Click to jump to top of pageClick to jump to parent topicHash

Syntax

Hash(ClearTextString)

Description

The Hash function returns a fixed length value, based on the input. The output is always 28 characters. The input is variable length, with no maximum size.

Regardless of the operating system platform, underlying character encoding or hardware byte order, identical character strings always generate identical hash values regardless of the platform on which the hash generation is run. Because of this, hash output should not be used as a unique key to a table of data. Given the output of hash, it is impossible to determine the input.

Some of the original data is deliberately lost during the conversion process. This way, even if you know the algorithm, you can't “un-hash” the data.

Generally the Hash function is used like a checksum, to compare hashed values to ensure they match.

Parameters

ClearTextString

Specify the string you want converted.

Returns

A hash string.

Example

MessageBox("Please confirm password"); &HASHPW = Hash(&PASSWD); &OPERPSWD = USERDEFN.OPERPSWD.Value; If not (&HASHPW = &OPERPSWD) Then /* do error handling */ End-if;

See Also

Decrypt, Encrypt.

Click to jump to top of pageClick to jump to parent topicHermiteCubic

Syntax

HermiteCubic(DataPoints)

Description

Use the HermiteCubic function to compute a set of interpolating equations for a set of at least three datapoints. This particular Hermitian cubic is designed to mimic a hand-drawn curve.

Parameters

DataPoints

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

Returns

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

See Also

CubicSpline, LinearInterp.

Click to jump to top of pageClick to jump to parent topicHide

Syntax

Hide(scrollpath, target_row, [recordname.]fieldname)

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 Hide function to make a page field invisible.

Note. This function remains for backward compatibility only. Use the Visible field class property instead.

You can display the field again using Unhide, but Unhide has no effect on a field that has been made display-only in the page definition.

Gray, Hide, Ungray, and Unhide usually appear in RowInit programs that set up the initial display of data, and in FieldChange programs that change field display based on changes the user makes to a field. Generally, you put the functions on the same scroll level as the field that is being changed. This reduces the complexity of the function’s syntax to:

Hide(fieldname)

The more complex syntax can be used to loop through a scroll on a lower level than the PeopleCode program.

Note. This function shouldn't be used in any event prior to RowInit.

See Also

Visible.

Accessing the Data Buffer

Specifying Data with References Using Scroll Path Syntax and Dot Notation

Parameters

scrollpath

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

target_row

An integer specifying the row on the target scroll level where the referenced buffer field is located.

[recordname .]fieldname

The name of the field to hide. The field can be on scroll level one, two, or three of the active page. The recordname prefix is required if the call to Hide is in a record definition other than recordname.

Returns

Boolean (optional). Hide returns a Boolean value indicating whether it executed successfully.

Example

This example hides the page’s address fields if SAME_ADDRESS_EMPL is equal to "Y":

If SAME_ADDRESS_EMPL = "Y" Then Hide(STREET1); Hide(STREET2); Hide(CITY); Hide(STATE); Hide(COUNTRY); Hide(HOME_PHONE); End-if;

See Also

Gray, Ungray, Unhide.

Click to jump to top of pageClick to jump to parent topicHideMenuItem

Syntax

HideMenuItem(BARNAME.menubar_name, ITEMNAME.menuitem_name)

Description

Use the HideMenuItem function to hide a specified menu item. To apply this function to a pop-up menu, use the PrePopup Event of the field with which the pop-up menu is associated.

If you’re using this function with a pop-up menu associated with a page (not a field), the earliest event you can use is the PrePopup event for the first “real” field on the page (that is, the first field listed in the Order view of the page in PeopleSoft Application Designer.)

When a menu is first displayed, all menus are visible by default, so there is no need for a function to re-display a menuitem that has been hidden.

Restrictions on Use With a Component Interface

This function is ignored (has no effect) when used by a PeopleCode program that’s been called by a Component Interface.

Parameters

menubar_name

Name of the menu bar that owns the menuitem, or, in the case of pop-up menus, the name of the pop-up menu that owns the menuitem.

menuitem_name

Name of the menu item.

Returns

None.

Example

HideMenuItem(BARNAME.MYPOPUP1, ITEMNAME.DO_JOB_TRANSFER);

See Also

DisableMenuItem, EnableMenuItem.

PrePopup Event

Click to jump to top of pageClick to jump to parent topicHideRow

Syntax

HideRow(scrollpath) [, target_row])

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 HideRow function to hide a row occurrence programmatically.

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

It hides the specified row and any associated rows at lower scroll levels.

Hiding a row just makes the row invisible, it does not affect database processing such as inserting new rows, updating changed values, or deleting rows.

When you hide a row, it becomes the last row in the scroll or grid, and the other rows are renumbered accordingly. If you later use UnHideRow to make the row visible again, it is not moved back to its original position, but remains in its new position. When HideRow is used in a loop, you have to process rows from the highest number to the lowest to achieve the correct results.

Note. HideRow cannot be executed from the same scroll level as the row that is being hidden, or from a lower scroll level. Place the PeopleCode in a higher scroll level record.

See Also

Visible.

Accessing the Data Buffer

Specifying Data with References Using Scroll Path Syntax and Dot Notation

Parameters

scrollpath

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

target_row

An integer specifying which row in the scroll to hide. If this parameter is omitted, the row on which the PeopleCode program is executing is assumed.

Returns

Boolean (optional). HideRow returns a Boolean value indicating whether the function executed successfully.

Example

This example hides all rows in scroll level 1 where the EXPORT_SW field is equal to "Y". Note that the loop has to count backwards from ActiveRowCount to 1.

For &ROW = ActiveRowCount(RECORD.EXPORT_OBJECT) to 1 step - 1 &EXPORT_SW = FetchValue(EXPORT_OBJECT.EXPORT_SW, &ROW); If &EXPORT_SW "Y" Then HideRow(RECORD.EXPORT_OBJECT, &ROW); Else /* WinMessage("not hiding row " | &ROW);*/ End-if; End-for;

See Also

UnhideRow, DeleteRow.

Click to jump to top of pageClick to jump to parent topicHideScroll

Syntax

HideScroll(scrollpath)

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 HideScroll function to programmatically hide a scroll bar and all data items within the scroll.

Note. This function remains for backward compatibility only. Use the HideAllRows rowset class method instead.

Typically this function is used in RowInit and FieldChange PeopleCode to modify the page based on user action.

See Also

HideAllRows.

Accessing the Data Buffer

Specifying Data with References Using Scroll Path Syntax and Dot Notation

Parameters

scrollpath

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

Returns

HideScroll returns a Boolean value indicating whether the function executed successfully.

Example

This example, from RowInit PeopleCode, initializes the visibility of the scroll based on a field setting:

If %Component = COMPONENT.APPR_RULE Then If APPR_AMT_SW = "N" Then HideScroll(RECORD.APPR_RULE_LN, CurrentRowNumber(1), RECORD.APPR_RULE_DETL, CurrentRowNumber(2), RECORD.APPR_RULE_AMT); Else UnhideScroll(RECORD.APPR_RULE_LN, CurrentRowNumber(1), RECORD.APPR_RULE_DETL, CurrentRowNumber(2), RECORD.APPR_RULE_AMT); End-If; End-If;

The corresponding FieldChange PeopleCode dynamically changes the appearance of the page based on user changes to the APPR_AMT_SW field:

If APPR_AMT_SW = "N" Then HideScroll(RECORD.APPR_RULEs_LN, CurrentRowNumber(1), RECORD.APPR_RULE_DETL, CurrentRowNumber(2), RECORD.APPR_RULE_AMT); &AMT_ROWS = ActiveRowCount(RECORD.APPR_RULE_LN, CurrentRowNumber(1), RECORD.APPR_RULE_DETL, CurrentRowNumber(2), RECORD.APPR_RULE_AMT); For &AMT_LOOP = &AMT_ROWS To 1 Step - 1 DeleteRow(RECORD.APPR_RULE_LN, CurrentRowNumber(1), RECORD.APPR_RULE_DETL, CurrentRowNumber(2), RECORD.APPR_RULE_AMT, &AMT_LOOP); End-For; Else UnhideScroll(RECORD.APPR_RULE_LN, CurrentRowNumber(1), RECORD.APPR_RULE_DETL, CurrentRowNumber(2), RECORD.APPR_RULE_AMT); End-If;

See Also

UnhideRow, HideRow, UnhideScroll.

Click to jump to top of pageClick to jump to parent topicHistVolatility

Syntax

HistVolatility(Closing_Prices, Trading_Days)

Description

Use the HistVolatility function to compute the historical volatility of a market-traded instrument.

Parameters

Closing_Prices

An array of number. The elements in this array contain a vector of closing prices for the instrument.

Trading_Days

The number of trading days in a year.

Returns

A number.

See Also

ConvertRate.

Click to jump to top of pageClick to jump to parent topicHour

Syntax

Hour(time_value)

Description

Use the Hour function to extract a Number value for the hour of the day based on a Time or Datetime value. The value returned is a whole integer and is not rounded to the nearest hour.

Parameters

time_value

A Datetime or Time value.

Returns

Returns a Number equal to a whole integer value from 0 to 23 representing the hour of the day.

Example

If &TIMEOUT contains a Time value equal to 04:59:59 PM, the following example sets &TIMEOUT_HOUR to 16:

&TIMEOUT_HOUR = Hour(&TIMEOUT);

See Also

Minute, Second.

Click to jump to top of pageClick to jump to parent topicIBPurgeDomainStatus

Syntax

IBPurgeDomainStatus()

Description

Use the IBPurgeDomainStatus function to purge the domain status.

Parameters

None.

Returns

A boolean value: true if the functions completes successfully, false otherwise.

Click to jump to top of pageClick to jump to parent topicIBPurgeNodesDown

Syntax

IBPurgeNodesDown()

Description

Use the IBPurgeNodesDown function to purge the down nodes from the service operation monitor.

Parameters

None.

Returns

Boolean: true if the function completes successfully, false otherwise.

Click to jump to top of pageClick to jump to parent topicIdiv

Syntax

Idiv(x, divisor)

Description

The Idiv function is an explicit integer division operation. It divides one number (x) by another (divisor).

Parameters

X

Specify an integer to be divided.

divisor

Specify the integer used to divide the first parameter.

Returns

An integer value.

Example

The following example sets &I1 to 1 and &I2 to -1:

&I1 = Idiv(3, 2); &I2 = Idiv(17, 10);

See Also

Mod, Int, Integer, Round, Truncate, Value.