PeopleCode Built-in Functions and Language Constructs: U

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

Syntax

UIDisplayMode()

Description

Use the UIDisplayMode function to return an Integer value indicating the user interface display mode of the current execution context (a combination of the active web profile configuration and the user’s browser):

Numeric Value

Description

0

Error (undefined)

1

Classic

2

Fluid

3

Small form factor optimized

Parameters

None.

Returns

A Integer value.

Example 1

In the following example, certain characteristics regarding the browser and web profile are obtained from the executing environment. In turn, these values are used to construct a cookie that is saved to the browser.

/* Read conditional navigation related parameters */
Local number &formfactor = %Request.BrowserDeviceFormFactor;
Local number &fluidCapable = UIDisplayMode();
/*Error - Default back to classic mode when undefined. */
If (&fluidCapable = 0) Then
   &fluidCapable = 1; /* Set to classic mode. */
End-If;

/* Set a browser cookie indicating these characteristics */
&cookieStr = "PS_CONDNAV" | "=" | &fluidCapable | "," | &formfactor | "; ";
&cookieStr = RTrim(&cookieStr, "; ");
&reqMsg.IBInfo.IBConnectorInfo.Cookies = &cookieStr;
&resMsg = %IntBroker.SyncRequest(&reqMsg, &targetNode);

Example 2

In the following example, the display mode is set as a property of the search object. Then, if the current mode is classic, certain characteristics are set for conditional navigation search mode:

...
   %This.nUIDisplayMode = UIDisplayMode();
   
   %This.SearchType = "S";
   %This.IsAdvancedSearch = False;
end-method;
...

method SetConditionalSearchNavMode
   /+ Returns Boolean +/
   If Not %This.bIsGlobalSearch Then
      Return False;
   End-If;
   
   Local string &name = "PTSF_NAV_MODE";
   If (%This.nUIDisplayMode = 1) Then
      %This.fg.MatchAny();
      %This.fg.EqualsString(&name, "1");
      %This.fg.NotEqualsString(&name, "2");
      %This.fg.EndMatchAny();
      Return True;
   End-If;
   Return False;
end-method;

Syntax

UnCheckMenuItem(BARNAME.menubar_name, ITEMNAME.menuitem_name)

Description

Use the UnCheckMenuItem function to remove a check mark from the specified menu item.

Note: This function has been deprecated.

Syntax

Unencode(URLString)

Description

Use the Unencode function to unencode URLString, converting all character codes of the form %xx where xx is a hex number, to the character represented by that number.

Parameters

Parameter

Description

URLString

Specify the string you want unencoded. This parameter takes a string value.

Returns

An unencoded URL string.

Example

For the following example, the URL is:

http://corp.office.com/human%20resources/benefits/401kchange_home.htm?FirstName=Gunter&LastName=D%c3%9crst

The encoded values are those beginning with the percentage sign (%). If you wanted to know the value in the Target Content’s URL for the parameter “LastName”, then the following PeopleCode would return the string “Dürst”:

&MENU = Unencode(%Request.GetParameter("LastName"));

This method works for any querystring in the Target Content’s URL.

If the link is constructed in a PeopleSoft Pure Internet Architecture page, and the value of a link field, you should not call EncodeURL to encode the entire URL, as the PeopleSoft Pure Internet Architecture does this for you. You must still unencode the parameter value when you retrieve it, however.

Syntax

UnGray(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 Ungray function to make a gray (non-editable) page field editable, if the field was grayed with a call to the Gray function.

Note: This function remains for backward compatibility only. Use the Enabled field property instead.

If the page field is made display-only in the Page Field Properties dialog, then Ungray has no effect.

The Gray, Ungray, Hide, and Unhide functions usually appear in RowInit programs that set up the initial display of data, and FieldChange programs that change field display based on changes the end user makes to a field.

Generally, you want to put this function on the same scroll level as the field that is being changed in RowInit (which executes on every row) or FieldChange (which executes on the current row). This simplifies the function’s syntax to:

UnGray(FIELDNAME)

A typical use of the more complex syntax is when looping through rows on a scroll on a lower level than the program.

Note: This function shouldn't be used in any event prior to RowInit.

Related Links

Gray, Hide, UnHide, Enabled, Understanding Data Buffer Access, Specifying Data with References Using Scroll Path Syntax and Dot Notation

Parameters

Parameter

Description

Scrollpath

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

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.

[recordname .]fieldname

The name of the field to make editable. The field can be on scroll level one, two, or three of the active page. The recordname prefix is required if the call to Ungray is not on the record definition recordname.

Returns

Optionally returns a Boolean value indicating whether the function executed successfully.

Example

The following example checks to see if a person’s emergency contact is the same as their home address and phone, then grays or ungrays the fields accordingly. In a typical case, this program would be in the FieldChange event.

If SAME_ADDRESS_EMPL = "Y" Then
   Gray(STREET1);
   Gray(STREET2);
   Gray(CITY);
   Gray(STATE);
   Gray(ZIP);
   Gray(COUNTRY);
   Gray(HOME_PHONE);
   STREET1 = PERSONAL_DATA.STREET1;
   STREET2 = PERSONAL_DATA.STREET2;
   CITY = PERSONAL_DATA.CITY;
   STATE = PERSONAL_DATA.STATE;
   ZIP = PERSONAL_DATA.ZIP;
   COUNTRY = PERSONAL_DATA.COUNTRY;
   HOME_PHONE = PERSONAL_DATA.HOME_PHONE;
Else
   UnGray(STREET1);
   UnGray(STREET2);
   UnGray(CITY);
   UnGray(STATE);
   UnGray(ZIP);
   UnGray(COUNTRY);
   UnGray(HOME_PHONE);
End-If;

Syntax

UnHide(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 use SCROLL. scrollname, where scrollname is the same as the scroll level’s primary record name.

Description

Use the Unhide function to make a field visible that was previously hidden with Hide. If the field was hidden by setting its Invisible property in the Page Field Properties dialog box, then Unhide has no effect.

Note: This function remains for backward compatibility only. Use the Visible field property instead.

Generally, you want to put this function on the same scroll level as the field that is being changed in RowInit (which executes on every row) or FieldChange (which executes on the current row). This simplifies the function’s syntax to:

UnHide(FIELDNAME)

A typical use of the more complex syntax is when looping through rows on a scroll on a lower level than the program.

Note: This function shouldn't be used in any event prior to RowInit.

Related Links

Hide, Visible, Understanding Data Buffer Access, Specifying Data with References Using Scroll Path Syntax and Dot Notation

Parameters

Parameter

Description

scrollpath

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

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.

[recordname .]fieldname

The name of the field to unhide. The field can be on scroll level one, two, or three of the active page. The recordname prefix is required if the call to Unhide is not on the record definition recordname.

Returns

Optionally returns a Boolean value indicating whether the function executed successfully.

Example

The following example sets security for displaying a person’s password:

If (&DISPLAY) Then
   UnHide(EMPLOYEE.PASSWORD);
Else
   Hide(EMPLOYEE.PASSWORD);
End-if;

Syntax

UnhideRow(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 use SCROLL. scrollname, where scrollname is the same as the scroll level’s primary record name.

Description

Use the UnhideRow function to programmatically unhide a row that has been hidden by HideRow. It unhides the specified row and any dependent rows at a lower scroll level.

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

UnhideRow works by putting the row that you unhide to the last non-hidden row in the list. When UnhideRow is used in a loop, you have to process rows from low to high to achieve the correct results.

Note: UnhideRow cannot be executed from the same scroll level where the insertion takes place, or from a lower scroll level. Place the PeopleCode in a higher scroll level record.

Related Links

Visible, Understanding Data Buffer Access, Specifying Data with References Using Scroll Path Syntax and Dot Notation

Parameters

Parameter

Description

scrollpath

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

target_row

An integer specifying which row in the scroll to unhide.

Returns

Optionally returns a Boolean value indicating whether the function executed successfully.

Example

      AE_ROW_COUNT = ActiveRowCount(RECORD.AE_STMT_TBL);
      for &ROW = ActiveRowCount(RECORD.AE_STMT_TBL) to 1 step - 1
         UnhideRow(RECORD.AE_STMT_TBL, &ROW);
         UpdateValue(RECORD.AE_STMT_TBL, &ROW, AE_ROW_NUM, &ROW);
      end-for;

Syntax

UnhideScroll(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 UnhideScroll function to programmatically unhide a scroll area that has been hidden with HideScroll. It unhides the specified scroll and any associated scrolls at a lower level.

Note: This function remains for backward compatibility only. Use the ShowAllRows rowset method instead.

Related Links

HideScroll, ShowAllRows, Understanding Data Buffer Access, Specifying Data with References Using Scroll Path Syntax and Dot Notation

Parameters

Parameter

Description

scrollpath

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

Returns

Optionally returns a Boolean value indicating whether the function executed successfully.

Example

This example clears the contents of a level-one hidden scroll, then unhides it:

   ScrollFlush(RECORD.ORDER_INQ_INV);
   UnhideScroll(RECORD.ORDER_INQ_INV);

The following example hides or unhides a level-three scroll:

If APPR_QTY_SW = "N" Then
   HideScroll(RECORD.APPR_RULE_LN, CurrentRowNumber(1), RECORD.APPR_RULE_DETL, CurrentRowNumber(2), RECORD.APPR_RULE_QTY);
Else
   UnhideScroll(RECORD.APPR_RULE_LN, CurrentRowNumber(1), RECORD.APPR_RULE_DETL, CurrentRowNumber(2), RECORD.APPR_RULE_QTY);
End-If;

Syntax

UniformSeriesPV(int_rate,n_per)

Description

Use the UniformSeriesPV function to calculate the present value of a single monetary unit after a uniform series of payments at a specified interest rate.

Parameters

Parameter

Description

int_rate

A Number specifying the interest rate on the basis of which to calculate the return value.

n_per

A Number specifying the number of payments in the uniform series.

Returns

Returns a Number equal to the value of a single unit after n_per payments at an interest rate of int_rate.

Example

The example sets &NUM to 3.790786769408448256:

&NUM = UniformSeriesPV(10,5);

Syntax

UnshareAttachment(URLID, DirAndFilePrefix, ShareMode, ShareRole, UsernameArray)

Description

Use the UnshareAttachment function to revoke sharing access to files in Oracle Content and Experience Cloud (CEC).

Parameters

Parameter

Description

URLID

Specifies an Oracle Content Cloud.

DirAndFilePrefix

A directory and file name prefix. This is appended to the folder path configured in the URLID parameter to get the actual file.

Note: Because the DirAndFilePrefix parameter is appended to the URL, it requires forward slashes (“/”). Backward slashes (“\”) are not supported for this parameter.

ShareMode

Specifies the sharing mode, which is revoked.

The sharing modes are:

  • %ShareMode_Member

  • %ShareMode_PublicRegisteredUsers

  • %ShareMode_PublicAnyone

ShareRole

Specifies the sharing roles, which is revoked.

The sharing roles are:

  • %ShareRole_Viewer

  • %ShareRole_Downloader

  • %ShareRole_Contributor

This parameter is not used when the sharing mode is %ShareMode_Member.

UsernameArray

Specifies users who are to be removed from sharing list.

This parameter is not used when the sharing mode is %ShareMode_PublicRegisteredUsers or %ShareMode_PublicAnyone.

If no value is passed in this parameter, an empty string array is assumed.

This is an optional parameter.

Returns

An integer value (0) irrespective of whether the function is successful or not.

Note: It is reserved for future use.

Example

Local array of string &users = CreateArrayRept("XYZ", 1);
Local string &share_url = "https://<host:port>/documents/fileview/<docID>/_PaySlip_XYZ";
UnshareAttachment(URLID.PAYSLIP, "PaySlip_XYZ", &share_url, %ShareMode_Member, 0, &users);

Description

Use the Until keyword to terminate a repeat loop. See Repeat for more information.

Syntax

UpdateSysVersion()

Description

Use the UpdateSysVersion function to coordinate system changes and changes to system objects maintained by pages, such as messages and Set Tables. This function is not normally used in standard applications and should only used in PeopleSoft-provided extensions of PeopleTools.

Returns

Returns the updated system version Number.

Example

The following example could be used to maintain the version number on MESSAGE_SET_TBL, which controls the refreshing of cache files for the message entries:

VERSION = UpdateSysVersion();

Syntax

UpdateValue(scrollpath, [recordname.]fieldname, target_row, value)

where scrollpath is:

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

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 UpdateValue function to update the value of a specified field with the value provided. The value must be of a data type compatible with the field.

Note: This function remains for backward compatibility only. Use the Value field property instead.

Related Links

Value, Understanding Data Buffer Access, Specifying Data with References Using Scroll Path Syntax and Dot Notation

Parameters

Parameter

Description

Scrollpath

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

target_row

An integer specifying the row of the field to update.

[recordname .]fieldname

The name of the field that you want to update. The field can be on scroll level one, two, or three of the active page. The recordname prefix is required if the call to UpdateValue is not on the record definition recordname.

Value

The new value to put into the target field.

Returns

None.

Example

This example updates values in the level-one scroll:

For &I = 1 To &ROW_CNT
   UpdateValue(RECORD.ASGN_CMP_EFFDT, &I, ITEM_SELECTED, "Y");
End-For;

The next example loops through rows in the level-two scroll:

For &I = 1 To &CURRENT_L2
   UpdateValue(RECORD.ASGN_CMP_EFFDT, &CURRENT_L1, RECORED.SOME_L2_RECORD, &I, TO_CUR, &HOME_CUR);
End-For;

Syntax

UpdateXmlDoc(&XmlDoc, PubID, PubNode, ChannelName, VersionName [, Message Name [, SubNode[, Segment]]])

Description

Use the UpdateXmlDoc function to update a message in the message queue with the specified message version.

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

If VersionName isn’t specified, the default message version is used. This method is commonly used in the OnRouteSend and OnRouteReceive PeopleCode events.

Note: This function can't be called from notification PeopleCode.

Related Links

UpdateXmlDoc

Parameters

Parameter

Description

&XmlDoc

Specify an already instantiated XmlDoc object.

PubID

Specify the PubID as a string.

PubNode

Specify the PubNode as a sting.

ChannelName

Specify the Channel name as a string.

VersionName

Specify the version name as a string.

MessageName

Specify the message name as a string. This is only used for Pub and Sub contracts.

SubNode

Specify the sub node as a string. This is only used for Pub contracts.

Segment

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

Returns

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

Syntax

Upper(str)

Description

Use the Upper function to convert a text string to all uppercase. This function can be used to perform a case-insensitive string comparison. Upper does not change characters that are not letters or characters that do not have case sensitivity.

Parameters

Parameter

Description

str

A String to convert to uppercase.

Returns

Returns a String value equal to str converted to all uppercase.

Example

The following example converts the contents of two string variables to uppercase before determining if they are equal to simulate a case-insensitive comparison:

If Upper(&STR1) = Upper(&STR2) Then 
   /* do something */ 
End-If;