PeopleCode Built-in Functions and Language Constructs: A
The PeopleCode built-In functions and language constructs beginning with the letter A are listed in alphabetical order within this topic.
Syntax
Abs(x)
Description
Use the Abs function to return a decimal value equal to the absolute value of a number x.
Parameters
Field or Control |
Definition |
---|---|
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);
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
Field or Control |
Definition |
---|---|
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.
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
Field or Control |
Definition |
---|---|
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.
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
Field or Control |
Definition |
---|---|
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);
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.
Parameters
Field or Control |
Definition |
---|---|
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;
Syntax
AddAttachment(URLDestination, DirAndFilePrefix, FileType, UserFileName[, MaxSize [, PreserveCase[, UploadPageTitle[, AllowLargeChunks]]]])
Description
Use the AddAttachment function to upload one file from an end user specified location (local storage or cloud storage) to a specified storage location. To upload more than one file with a single function call, use the MAddAttachment function.
Important! It is the responsibility of the calling PeopleCode program to store the returned file name for further use.
If a file exists at a particular place on a storage location and then another file with the same name is uploaded to that same place on that same storage location, the original file will be silently overwritten by the new file. If that is not the behavior you desire, it is recommended that you implement PeopleCode to guarantee the ultimate uniqueness of either the name of the file at its place on the storage location or the name of its place (the subdirectory) on the storage location.
You cannot use a relative path to specify the file that is to be uploaded; you must use a full path. If end users experience problems in uploading files, ensure that they browse to the file they wish to upload rather than attempting to manually enter the full path name of the file. This problem can manifest itself differently depending on the browser used. For example, with some browser versions, the PeopleSoft page appears to be in an infinite “Processing” state. Information is available on working with different browsers.
See PeopleTools Browser Compatibility Guide (Oracle Support Document 704492.1) on My Oracle Support for more information.
Additional information that is important to the use of AddAttachment can be found in the PeopleTools: PeopleCode Developer's Guide:
PeopleTools supports multiple types of storage locations.
Certain characters are illegal in file names; other characters in file names are converted during file transfer.
Non-ASCII file names are supported by the PeopleCode file attachment functions.
The PeopleCode file attachment functions do not provide text file conversions when files are attached or viewed.
Because AddAttachment is interactive, it is known as a “think-time” function, and is restricted from use in certain PeopleCode events.
See Restrictions on Invoking Functions in Certain PeopleCode Events.
Virus scanning can be performed on all files uploaded with the AddAttachment function.
The HTML sanitizer can be enabled and configured to scan and sanitize specific HTML file types (specified by file extension) uploaded with the AddAttachment function.
Parameters
Field or Control |
Definition |
---|---|
URLDestination |
Specify the destination storage location for the file to be uploaded. This can be either a URL identifier in the form URL.URL_ID, or a string. This is where the file is transferred to. Note: When the URLDestination parameter is specified as a string value, forward slashes (/) are required. Backward slashes (\) are not supported for a string value. Note: Oracle recommends that
you do not use a URL of the form |
DirAndFilePrefix |
A directory and file name prefix. This is appended to the URLDestination to make up the full URL when the file is transferred to an FTP server or, when the file transferred to a database table, to make the file name unique. Note: If the destination location is an FTP server, then it is very important whether the value passed into a call of AddAttachment for the DirAndFilePrefix parameter ends with a slash or not. If the value for the DirAndFilePrefix parameter ends with a slash, then it will be appended to the value of the URLDestination and used to indicate the relative (to the configured root directory of the FTP server) path name of the directory in which the uploaded file will be stored. If the value for the DirAndFilePrefix parameter does not end with a slash, then the portion of it prior to its right-most slash will be appended to the value of the URLDestination and used to indicate the relative (to the configured root directory of the FTP server) path name of the directory in which the uploaded file will be stored, and the portion after the right-most slash will be prepended to the name of the file that will be created at the destination. Note: Because the DirAndFilePrefix parameter is appended to the URL, it also requires forward slashes (“/”). Backward slashes (“\”) are not supported for this parameter. |
FileType |
The file extension as a string. Since this parameter is required, a value must be specified; however, the value is currently ignored. |
UserFileName |
Returns the name of the file on the source system. Specify UserFileName as a string variable or a field reference in the form of [recordname.]fieldname. You must supply the recordname only if the record field and your PeopleCode program are in different record definitions. AddAttachment returns the user-selected file name in this parameter, so its initial value is ignored and it must not be specified as a string constant. Note: The file name for the user-selected file cannot be greater than 64 characters. |
MaxSize |
Specify, in kilobytes, the maximum size of the attachment. If you specify 0, it indicates “no limit,” so any file size can be uploaded. The default value of this parameter is 0. Note: The system cannot check the size of the file selected by the end user until that file has been uploaded to the web server. |
PreserveCase |
Specify a Boolean value to indicate whether the case of the extension of the file to be uploaded is preserved or not at the storage location; True, preserve the case, False, convert the file name extension to all lowercase letters. The default value is False. Warning! If you use the PreserveCase parameter, it is important that you use it in a consistent manner with all the relevant file-processing functions or you may encounter unexpected file-not-found errors. Note: AddAttachment provides no indication of a conversion in the file name it returns. |
UploadPageTitle |
Specify a string value to be displayed in the title bar of the file attachment dialog box (as its title). This string should be simple text and contain no HTML elements. If no value is specified, the default value is “File Attachment.” Note: In screen reader mode, the string value of the UploadPageTitle parameter is displayed in the body of the file attachment dialog box rather than as the title of the window. 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. |
AllowLargeChunks |
Specify a Boolean value to indicate whether to allow large chunks. If the value specified in the Maximum Attachment Chunk Size field on the PeopleTools Options page is larger than is allowed for retrieval, then the system breaks the file upload into the largest sized chunks allowed. If AllowLargeChunks is set to True, this behavior can be overridden so that it is possible for an end user to upload a file in chunks that are too large for the system to retrieve. If AllowLargeChunks is set to False, the system will use the largest size chunk that is allowed for retrieval, or the configured chunk size, whichever is smaller. Note: If the chunks are too big to be retrieved, then any file retrieval built-in function, such as GetAttachment, will fail. Note: The AllowLargeChunks parameter is only applicable when the storage location is a database record. It has no impact when the storage location is an FTP site or an HTTP repository, since attachments at those locations are never chunked. This is an optional parameter. The default value is False. |
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 transfer failed due to unspecified error. The following are some possible situations where %Attachment_Failed could be returned:
|
2 |
%Attachment_Cancelled |
File transfer didn't complete because the operation was canceled by the end user. |
3 |
%Attachment_FileTransferFailed |
File transfer failed due to unspecified error during FTP attempt. The following are some possible situations where %Attachment_FileTransferFailed could be returned:
|
6 |
%Attachment_FileExceedsMaxSize |
File exceeds maximum size, if specified. |
7 |
%Attachment_DestSystNotFound |
Cannot locate destination system for FTP. The following are some possible situations where %Attachment_DestSystNotFound could be returned:
|
8 |
%Attachment_DestSysFailedLogin |
Unable to login to destination system for FTP. The following are some possible situations where %Attachment_DestSysFailedLogin could be returned:
|
9 |
%Attachment_FileNotFound |
Cannot locate file. The following are some possible situations where %Attachment_FileNotFound could be returned:
|
11 |
%Attachment_NoFileName |
File transfer failed because no file name was specified. |
12 |
%Attachment_FileNameTooLong |
File transfer failed because name of selected file name is too long. Maximum is 64 characters. |
13 |
%Attachment_ViolationFound |
File violation detected by virus scan engine. |
14 |
%Attachment_VirusScanError |
Virus scan engine error. |
15 |
%Attachment_VirusConfigError |
Virus scan engine configuration error. |
16 |
%Attachment_VirusConnectError |
Virus scan engine connection error. |
21 |
%Attachment_Rejected |
File transfer failed because the file extension is not allowed. |
Example
&retcode = AddAttachment(URL.MYFTP, ATTACHSYSFILENAME, "", ATTACHUSERFILE, 0);
An example of the AddAttachment function is provided in the demonstration application delivered in the FILE_ATTACH_WRK derived/work record. This demonstration application is shown on the PeopleTools Test Utilities page.
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
Field or Control |
Definition |
---|---|
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 |
Field or Control |
Definition |
---|---|
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.
Syntax
AddJavaScript(HTML.JS_NAME)
Description
Use the AddJavaScript function to add JavaScript to the HTML document for the page or component.
Important! Use this function within fluid applications only.
Parameters
Field or Control |
Definition |
---|---|
HTML.JS_NAME |
Specifies the JavaScript code as an HTML object stored in the database. |
Returns
None.
Example
AddJavaScript(HTML.PT_JQUERY_1_6_2_JS);
AddJavaScript(HTML.PTPG_NUI_GRID_JS);
AddJavaScript(HTML.PT_ACE_USER);
AddJavaScript(HTML.PT_ACE_LOAD);
AddJavaScript(HTML.PTS_NUI_SRCH);
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 or Control |
Definition |
---|---|
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");
Syntax
AddMetaTag(tag_name, tag_value)
Description
Use the AddMetaTag function to add a meta tag to the HTML document for the page or component.
Important! Use this function within fluid applications only.
Parameters
Field or Control |
Definition |
---|---|
tag_name |
Specifies the name of the meta tag as a string value. |
tag_value |
Specifies the value of the meta tag as a string value. |
Returns
None.
Example
AddMetaTag("viewport", "user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0");
Syntax
AddOnLoadScript(onload_script)
Description
Use the AddOnLoadScript function to add the JavaScript code to be executed in the onload event of the HTML document.
Important! Use this function within fluid applications only.
Parameters
Field or Control |
Definition |
---|---|
onload_script |
Specifies the JavaScript code to be executed in the onload event of the HTML document as a string value. |
Returns
None.
Example
AddOnLoadScript("document.querySelector('.ps_header').style.display = 'none';");
Syntax
AddStyleSheet(StyleSheet.STYLESHEET_NAME)
Description
Use the AddStyleSheet function to add a free form style sheet to the HTML document for the page or component.
Important! Use this function within fluid applications only.
Parameters
Field or Control |
Definition |
---|---|
StyleSheet.STYLESHEET_NAME |
Specifies the style sheet as a style sheet object stored in the database. |
Returns
None.
Example
AddStyleSheet(StyleSheet.PTNUI_DOCK_CSS_R);
AddStyleSheet(StyleSheet.PTNUI_MODAL_CSS);
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.
A pause time is an interval of time during which the node becomes inactive. When the pause time begins, the node is shut down until the pause time is scheduled to end.
Parameters
Field or Control |
Definition |
---|---|
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 |
Field or Control |
Definition |
---|---|
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 |
Field or Control |
Definition |
---|---|
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;
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
Field or Control |
Definition |
---|---|
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);
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
Field or Control |
Definition |
---|---|
datetime |
The initial Datetime value. |
years |
An integer representing the number of years to add to datetime. |
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
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);
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
Field or Control |
Definition |
---|---|
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 Declare Function.
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
Field or Control |
Definition |
---|---|
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;
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:
All of the fields have values (that is, are not Null).
None of the fields has a value.
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
Field or Control |
Definition |
---|---|
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;
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, EMPLID is a required 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
Field or Control |
Definition |
---|---|
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;
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.
Field or Control |
Definition |
---|---|
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".
Description
Use And to combine Boolean expressions. See Boolean Operators for more information.
Description
Use the As keyword in function and method declarations and when downcasting an object to a subclass.
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
Field or Control |
Definition |
---|---|
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);
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
Field or Control |
Definition |
---|---|
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);