PeopleCode Built-in Functions and Language Constructs: N
The PeopleCode built-In functions and language constructs beginning with the letter N are listed in alphabetical order within this topic.
Syntax
NextEffDt(field)
Description
Use the NextEffDt function to return the value of the specified field from the record with the next effective date (and effective sequence number if specified). The return value is an Any data type. This function is valid only for effective-dated records.
If the next record doesn't exist, the statement is skipped. If the NextEffDt function isn't a top-level statement, that is, if it's contained within a compound statement or a loop, the statement is skipped and execution restarts with the next top-level statement.
In the following example, execution skips to the top If statement:
If ACTION <> "REH" Then /* skip to here if NextEffDt fails to find next record */
If STD_HOURS <> NextEffDt(STD_HOURS) And
Day(EFFDT) <> 1 Then
Error MsgGet(30000, 8, "Meldung nicht vorhanden - WAZ bzw. Beschäftigungsgradänderungen sind nur zum ersten eines Monats zulässig.")
End-If;
End-If;
/* if NextEffDt fails, run to here directly */
Related Links
Syntax
NextRelEffDt(search_field, fetch_field)
where fieldlist is an arbitrary-length list of fields in the form:
field1 [,field2]. . .
Description
Use the NextRelEffDt function to locate the next occurrence of the search_field with the next effective date (and effective sequence number if the record contains an effective sequence number). It then returns the value of the specified fetch_field corresponding to the search_field. The return value is an Any data type. Typically, this function is used to retrieve values for related display fields.
This function is valid only for effective-dated records.
If a next record doesn't exist, the statement is skipped. If the NextRelEffDt function isn't a top-level statement, that is, if it's contained within a compound statement or a loop, the statement is skipped and execution restarts with the next top-level statement.
Related Links
Syntax
NodeDelete(nodeName)
Description
Use the NodeDelete function to delete the specified node and all subordinate objects (transactions, node properties, certificates, and so on.)
Warning! Once this function has completed, you cannot recover the node.
Event Considerations
PeopleSoft recommends only using this function in the SavePostChange event. In addition, you should put a warning in the SaveEdit event, so the user has a chance to change their mind about deleting the node.
If you use a pushbutton on a page to delete a node, PeopleSoft recommends the following code in the FieldChange event:
If %Page = Page.YourDeletePage Then
/* changes the record in the buffer so that the DoSaveNow fires */
PSMSGNODEDEFN.DESCR = PSMSGNODEDEFN.DESCR | " ";
DoSaveNow();
ClearKeyList();
/* Transfer to another component or display information message; */
End-If;
Parameters
Field or Control |
Definition |
---|---|
nodeName |
Specify the name of the node you want to delete, as a string. All node names are uppercase. |
Returns
A Boolean value: True, the function completed successfully deleted, False otherwise.
Example
&Rslt = NodeDelete("QEM_TEST_NODE");
If Not &Rslt Then
/* Do error processing */
End-if;
Syntax
NodeRename(oldNodeName, newNodeName)
Description
Use the NodeRename function to rename a node. All node names are uppercase.
Event Considerations
PeopleSoft recommends using this function only in the SavePreChange event. This gives the user a chance to edit any other page fields before executing, which may be important because this function affects several tables.
Parameters
Field or Control |
Definition |
---|---|
oldNodeName |
Specify the name of the node that you want to change, as a string. |
newNodeName |
Specify the new name for the node, as a string. |
Returns
A Boolean value: True, the function completed successfully deleted, False otherwise.
Example
&Rslt = NodeRename("QEM_TEST_NODE", "QE_TEST_NODE");
If Not &Rslt Then
/* Do error processing */
End-if;
Syntax
NodeSaveAs(oldNodeName, newNodeName)
Description
Use the NodeSaveAs function to create a copy of the node specified by oldNodeName, and save it to the database as newNodeName. All node names are uppercase.
Event Considerations
PeopleSoft recommends using this function only in the SavePreChange event. This gives the user a chance to edit any other page fields before executing, which may be important because this function affects several tables.
Parameters
Field or Control |
Definition |
---|---|
oldNodeName |
Specify the name of the node that you want to copy, as a string. |
newNodeName |
Specify the name for the new node, as a string. |
Returns
A Boolean value: True, the function completed successfully deleted, False otherwise.
Example
&Rslt = NodeSaveAs("PRODUCTION_NODE", "MY_TEST_NODE");
If Not &Rslt Then
/* Do error processing */
End-if;
Syntax
NodeTranDelete(MsgNodeName, EffDt, TrxType, RqstMsgName, RqstMsgVer)
Description
Use the NodeTranDelete function to delete a node transaction.
Warning! If you delete a node transaction, any transaction modifier using that transaction is also deleted.
Parameters
Field or Control |
Definition |
---|---|
MsgNodeName |
Specify the message node name as a string. |
EffDt |
Specify the effective date as a string. |
TrxType |
Specify the transaction type as a string. |
RqstMsgName |
Specify the request message name as a string. |
RqstMsgVer |
Specify the request message version as a string. |
Returns
A Boolean value, True if the function completed successfully, False otherwise.
Example
&ret = NodeTranDelete("QE_LOCAL", "1900-01-01", "IA", "ROLESYNCH_MSG",
"VERSION_1");
Syntax
None(fieldlist)
where fieldlist is an arbitrary-length list of fields in the form:
[recordname.]fieldname1 [, [recordname.]fieldname2] ...
Description
The None function takes an arbitrary number of field names as parameters and tests for values. None returns True if none of the specified fields contain a value. It returns False if any one of the fields contains a value.
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. |
AllOrNone |
Checks if either all the field parameters have values, or none of them have values. Use this in cases where if an end user fills in one field, she must all fill in the other related values. |
OnlyOne |
Checks if exactly one field in the set has a value. Use this when the end 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 end user puts can put a value into one field in a set of fields, or leave them all empty. |
Example
The following example uses None to check whether REFERRAL_SOURCE has a value:
If None(REFERRAL_SOURCE) or
REFERRAL_SOURCE = "EE" Then
Gray(EMP_REFERRAL_ID);
End-if;
The following example uses None with a variable:
&ONETIME = FetchValue(POSN_INCUMB_WS.EMPLID, 1);
If None(&ONETIME) Then
/* do processing */
End-if;
Description
Use Not to negate Boolean expressions. See Boolean Operators for more information.
Syntax
NotifyQ(logical queue ID, task type)
Description
Use the NotifyQ function to notify the queue server of an incoming task. NotifyQ should always follow the use of the EnQueue function. EnQueue inserts the task into the PeopleSoft database, and NotifyQ notifies the queue server about a task's existence and location.
When you process a batch of tasks to be enqueued, PeopleSoft recommends calling NotifyQ just once (after the last task is processed). NotifyQ forces the queue server to reorder its internal lists and save its state to the database, and therefore affects performance.
NotifyQ is not required for chat or voice tasks, and should not be used for these tasks.
Note: If tasks of different types or tasks that are assigned to different logical queues are enqueued, at least one NotifyQ is required for each logical queue and for each task type. This ensures that the system is notified of tasks waiting to be assigned.
Parameters
Field or Control |
Definition |
---|---|
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 NotifyQ function must exactly match the case used when creating the logical queue ID on the Queues page. |
task type |
Specifies the type of task to be inserted. It is a string value. The valid values are:
|
Returns
Returns 0 if the function was successful.
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
&strtasknum = EnQueue(&queueID, "email", &MyCompURL, &langcode,
&subject, "QEDMO", 15, 60, &cost, &priority, &minskill);
&nret = NotifyQ(&queueID, "email");
If &nret = 0 Then
MessageBox(0, "", 162, 1547, "Queue Successfully notified.");
End-If
Syntax
NumberToDisplayString(Format, Number [, Width] [, Precision])
Description
Use the NumberToDisplayString function to format Number according to the pattern specified in Format. The decimal and thousand's separator are formatted with what is with the current user's personalizations.
Specify the Width and Precision parameters when you want to dynamically specify the width or precision. Both width and precision can be set based on Format. For example, the following statically specifies the width to be 6, and the precision to be 2:
&MyValue = NumberToDisplayString("%6.2", &Num);
The following example show the width taken dynamically from the &Width variable:
&MyValue = NumberToDisplayString("%*.2", &Num, &Width);
The following example shows how both the width and the precision values are taken dynamically from the &Width and &Precision variables, respectively.
&MyValue = NumberToDisplayString("%*.*", &Num, &Width, &Precision);
Parameters
Field or Control |
Definition |
---|---|
Format |
Specify the pattern for how Number is supposed to be formatted. See Using the Format parameter, below. |
Number |
Specify the number to be formatted. |
Width |
Specify the width of the string to be formatted. |
Precision |
Specify the precision of the string to be formatted. |
Using the Format Parameter
The Format parameter has the following format:
%[flags][width][.precision][R | T] [type]
Flags have the following format:
Flag
Description
-
Left align the number.
$
Fill out field on left hand side with international currency symbol.
#
Force the number to have a decimal point.
blank
Pad left hand side with blanks only indicating a negative number with a '-' sign.
+
Prefix output with plus sign.
M
Append " (cr)" on right for negative numbers and " (dr)" for positive numbers.
m
Opposite of M: " (dr)" for negative and " (cr)" for positive.
A
Bracket negative numbers with "[" and "]".
a
Bracket negative numbers with "(" and ")".
q
Display zeros as blanks.
Q
Display zeros as "None".
0
Pad left hand side with zeroes. This must be the last flag before any other pattern indicators.
Width must be specified as a non-negative integer. Specifying an asterisks ("*") allows for dynamic field width specification. The maximum width is 50.
Precision specifies how many digits follow the ".". It must be specified as a non-negative integer. Specifying an asterisks ("*") allows for a dynamic precision specification. The maximum precision is 50.
R specifies rounding in conversion from the internal PeopleCode representation, that is, specifying 12.345 with precision of 2 (%n.2Rt) prints 12.35. In the absence of the R control rounding is the default.
T specifies truncation in conversion from the internal PeopleCode representation, that is, specifying 2.345 with precision of 2 (%n.2Tt) prints 12.34.
Type has the following format:
Type
Description
t
Type has format like printf %f. For example, the form dddd.dddd. This is the default value.
v
1000ths separator delimited output. For example, if the separator is a comma, the format is 1,000,000.02.
w
Scientific format like printf %e. For example, the form d.ddddeddd where "e" indicates exponent. d specifies 1 decimal digit and dddd specifies an arbitrary number.
W
Scientific format (like above, for "w") except "e" is "E".
z
Scientific Engineering format like printf %e where the exponent is always a multiple of 3 and the mantissa is between 1 and a 1000.
Z
Scientific Engineering format (like above, for "z") except "e" is "E".
Returns
A string value.
Example
In the following example, &Str1 would be "0001234,56".
&Num = 1234.56;
&Str1 = NumberToDisplayString("%#010.2t", &Num);
In the following example, &Str2 would be "$$$1234.56".
&Num = 1234.56;
&Str2 = NumberToDisplayString("%$10.2", &Num);
In the following example, &Str3 would be " 1,234.56".
&Num = 1234.56;
&Str3 = NumberToDisplayString("%10.2v", &Num);
In the following example, &Str4 would be "1.23456e+003".
&Num = 1234.56;
&Str4 = NumberToDisplayString("%w", &Num);
Syntax
NumberToString(Format, Number [, Width] [, Precision])
Description
Use the NumberToString function to format Number according to the pattern specified in Format.
Specify the Width and Precision parameters when you want to dynamically specify the width or precision. Both width and precision can be set based on Format. For example, the following statically specifies the width to be 6, and the precision to be 2:
&MyValue = NumberToString("%6.2", &Num);
The following example show the width taken dynamically from the &Width variable:
&MyValue = NumberToString("%*.2", &Num, &Width);
The following example shows how both the width and the precision values are taken dynamically from the &Width and &Precision variables, respectively.
&MyValue = NumberToString("%*.*", &Num, &Width, &Precision);
Parameters
Field or Control |
Definition |
---|---|
Format |
Specify the pattern for of how Number is supposed to be formatted. |
Number |
Specify the Number to be formatted. |
Width |
Specify the width of the string to be formatted. |
Precision |
Specify the precision of the string to be formatted. |
Using the Format Parameter
The Format parameter has the following format:
%[flags][width][.precision][R | T] [type]
Flags have the following format:
Flag
Description
-
Left align the number.
$
Fill out field on left hand side with international currency symbol.
#
Force the number to have a decimal point.
blank
Pad left hand side with blanks only indicating a negative number with a '-' sign.
+
Prefix output with plus sign.
M
Append " (cr)" on right for negative numbers and " (dr)" for positive numbers.
m
Opposite of M: " (dr)" for negative and " (cr)" for positive.
A
Bracket negative numbers with "[" and "]".
a
Bracket negative numbers with "(" and ")".
q
Display zeros as blanks.
Q
Display zeros as "None".
0
Pad left hand side with zeroes. This must be the last flag before any other pattern indicators.
Width must be specified as a non-negative integer. Specifying an asterisks ("*") allows for dynamic field width specification. The maximum width is 50.
Precision specifies how many digits follow the ".". It must be specified as a non-negative integer. Specifying an asterisks ("*") allows for a dynamic precision specification. The maximum precision is 50.
R specifies rounding in conversion from the internal PeopleCode representation, that is, specifying 12.345 with precision of 2 (%n.2Rt) prints 12.35. In the absence of the R control rounding is the default.
T specifies truncation in conversion from the internal PeopleCode representation, that is, specifying 2.345 with precision of 2 (%n.2Tt) prints 12.34.
Type has the following format:
Type
Description
t
Type has format like printf %f. For example, the form dddd.dddd. This is the default value.
v
1000ths separator delimited output. For example, if the separator is a comma, the format is 1,000,000.02.
w
Scientific format like printf %e. For example, the form d.ddddeddd where "e" indicates exponent. d specifies 1 decimal digit and dddd specifies an arbitrary number.
W
Scientific format (like above, for "w") except "e" is "E".
z
Scientific Engineering format like printf %e where the exponent is always a multiple of 3 and the mantissa is between 1 and a 1000.
Z
Scientific Engineering format (like above, for "z") except "e" is "E".
Returns
A string value.
Example
In the following example, &Str1 would be "0001234.56".
&Num = 1234.56;
&Str1 = NumberToString("%#010.2t", &Num);
In the following example, &Str2 would be "$$$1234.56".
&Num = 1234.56;
&Str2 = NumberToString("%$10.2", &Num);
In the following example, &Str3 would be " 1,234.56".
&Num = 1234.56;
&Str3 = NumberToString("%10.2v", &Num);
In the following example, &Str4 would be "1.23456e+003".
&Num = 1234.56;
&Str4 = NumberToString("%w", &Num);