setcursorpos peoplecode peoplesoft

setcursorpos peoplecode peoplesoft

SetCursorPos PeopleCode PeopleSoft Using the SetCursorPos to place the focus in a specific field anywhere in the current component. To transfer to a page outside the current component, use Transfer.

SetCursorPos(Page.pagename, scrollpath, target_row, [recordname.]fieldname)

where scroll path 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.

peoplesoft setcursorpos level 1

This peoplecode for setcursorpos of field in scroll area or grid level 1

The page name is Page_name

The Record.field is  TS_TBL.DESCR254_5

The row number of the row in which you want to place the cursor is 1.

SetCursorPos(Page.Page_name, TS_TBL.DESCR254_5, 1);

SetCursorPos(Page.Page_name, TS_TBL.DESCR254_5, currentrownumber());

More Example of peoplesoft setcursorpos level 1

setcursorpos peoplecode level 2

 

Page Name : TS_TRC_BOSSAPPV

Record Level 1 = TS_TRC_TRAN

Row of level 1 = 1

Record level 2 = TS_TRC_FILE

Row of level 2 = 1

SetCursorPos(Page.TS_TRC_BOSSAPPV, Record.TS_TRC_TRAN, 1, Record.TS_TRC_FILE, 1, TS_TRC_FILE.ATTACHUSERFILE);

 

Refresh Page PeopleCode

Refresh Page PeopleCode

How to Refresh Page PeopleCode after save or equal to F5.

1. You can use this PeopleCode after saving at last statement. This code refreshes the whole your page.

            GetLevel0().Refresh(); 

2. Using Java Script

2.1 You Create HTML object for replace java script code is name = PAGE_LOAD

2.2 Define code to record filed HTML

DERIVED_TBL.HTMLAREA.Value = GetHTMLText(HTML.PAGE_LOAD)

2.3 Using Meta HTML TEXT at below

How to use Meta HTML PeopleSoft

How to Check Number/ Letter Peoplecode

How to Check Number/ Letter Peoplecode

How to Check Number/ Letter Peoplecode function from input value. You can use this peoplecode function at below.

 

 

Reference :http://www.compshack.com/peoplecode/peoplecode-check-number-and-check-letter-functions#comment-4979

 

How to access related field on grid by peoplecode

How to access related field on grid by peoplecode

How to access related field on grid by peoplecode of peoplesoft.

My requirement:

How to access related field DESCR100 of table CNTRC_TRAN and field EMPLID3 in all row of grid.

 

 

How to Disable Grid Column using Page Field Name Peoplecode

How to Disable Grid Column using Page Field Name Peoplecode

How to Disable Grid Column using Page Field Name Peoplecode. You can use disable of grid column using page Field Name for define value and access page field name by Peoplecode of Peoplesoft.

Assuming the grid’s Page Field Name value is “GRID_NAME” and the column’s Page Field Name value is “LINK” , you can use the following code

GetGrid(Page.STUD_AD_SP, “ADM_VW”).LINK.Visible = False;

If many requirement about grid such as user want to change column label name by condition automatically. You can coding from below link.

How to Change Grid Column Name of Grid/Scroll level 1 in Peoplecode Dynamically

How to access related field on grid by peoplecode

How to Change Grid Column Name of Grid/Scroll level 1 in Peoplecode

how to convert string to date peoplesoft

How to convert string to date peoplesoft

How to convert string to date peoplesoft using function peoplecode.

You can convert string to date by peoplecode using Datevalue().

DateValue(date_str)

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

Example

&Currentdate = DateValue(’14/09/2018′);

&Currentdate= Date value.

 

 

Reference:

https://docs.oracle.com/cd/E41633_01/pt853pbh1/eng/pt/tpcl/langref_PeopleCodeBuilt-inFunctionsandLanguageConstructs-073e6a.html#DateValue-073de2

peoplecode last day of month

peoplecode last day of month

peoplecode last day of month using function last_day of sql and using sqlexec of peoplecode for select last day of month

Using SQL

select last_day(add_months((sysdate),0)) from dual;

Using Peoplecode

Sqlexec(“select last_day(add_months((sysdate),0)) from dual”,&last_day_of_month);

add months to date in peoplecode

add months to date in peoplecode

add months to date in peoplecode using function is AddToDate of PeopleSoft. This function to add the specified number of years, months, and days to the date provided.

Syntax: AddToDate(date, num_years, num_months, num_days)

Example add date forward 2 year, 6 months.

&result_dt = 03/03/2021

References:

http://peoplesoft.wikidot.com/addtodate
https://docs.oracle.com/cd/E13292_01/pt849pbr0/eng/psbooks/tpcl/book.htm?File=tpcl/htm/tpcl02.htm#H2001

isuserinrole peoplesoft

isuserinrole peoplesoft

isuserinrole peoplesoft is peoplecode function check whether user belongs to a role through peoplecode.

Syntax: IsUserInRole(rolename1 [, rolename2]. . .)

Return a Boolean value:
True if the current user belongs to one or more of the roles in the user role array,
False otherwise

For example 1:

&CheckFlag =  IsUserInRole(“ROLE_NAME”)

&CheckFlag contains true if the currnet user has ROLE_NAME in his profile.

 

For example 2:

 

References:

http://peoplesoft-erp-hcm.blogspot.com/2012/12/check-whether-user-belongs-to-role.html

https://docs.oracle.com/cd/E13292_01/pt849pbr0/eng/psbooks/tpcl/chapter.htm?File=tpcl/htm/tpcl02.htm

%mode peoplesoft

%mode peoplesoft

%mode peoplesoft returns a String value consisting of an uppercase character specifying the action a user selected when starting the current component. The following values can be returned. You can check either for the string value (“A”, “U”, and so on.) or for the 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

 

Refererence: https://docs.oracle.com/cd/E26239_01/pt851h3/eng/psbooks/tpcl/chapter.htm?File=tpcl/htm/tpcl04.htm