SetCursorPos in Peoplesoft

SetCursorPos in Peoplesoft

How to use function peoplecode of peoplesoft about setcursorpos in peoplesoft. You can use this function for fix position of cursor on page.

This Syntax :  SetCursorPos(Page.pagename,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.

Pagename: The name of the page specified in the page definition, preceded by the keyword Page. The page name page must be in the current component. You can also pass the %page system variable in this parameter (without the Page reserved word).

scrollpath: A construction that specifies a scroll level in the component buffer.
[recordname .]fieldname: Specify a field designating the record and field in the scroll where you want to place the cursor.

target_row: The row number of the row in which you want to place the cursor.

 

This is example code set cursor when control cursor in page activate

This picture has page name is TEST_PAGE include scroll area level 1 is record of TEST_TBL. My requirement check Flag.

If  Flag = Y then Set cursor at TEST_TBL.DESCR254_1.

If Flag = N then Set cursor at TEST_TBL.DESCR254_2.

Example 1 : SetCursorPos(Page.Page_name, Record.Field, &i);

You place peoplecode at page activate by condition if flag = Y then set cursor at Descr254_1.

This code is “SetCursorPos(Page.test_page, Record.TEST_TBL.Descr254_1, &i);”

Result

Example 2 :

SetCursorPos(Page.Page_name, Record.Field, &i);

You place peoplecode at page activate by condition if flag = N then set cursor at Descr254_2.

This code is “SetCursorPos(Page.test_page, Record.TEST_TBL.Descr254_2, &i);”

Result

 

 

Ref: https://docs.oracle.com/cd/E15645_01/pt850pbr0/eng/psbooks/tpcl/chapter.htm?File=tpcl/htm/tpcl02.htm%23g037ee99c9453fb39_ef90c_10c791ddc07__3c78

Messagebox Peoplecode

Messagebox Peoplecode

How to use messagebox peoplecode in Peoplesoft. You can Messagebox in PeopleCode event and use an application engine that shows in view log/trace.

This syntax

MessageBox(style,title,message_set, message_num,default_txt [, paramlist])

Returns either a Number value or a constant.

Value Constant Meaning
-1 %MsgResult_Warning Warning was generated.
1 %MsgResult_OK OK button was selected.
2 %MsgResult_Cancel Cancel button was selected.
3 %MsgResult_Abort Abort button was selected.
4 %MsgResult_Retry Retry button was selected.
5 %MsgResult_Ignore Ignore button was selected.
6 %MsgResult_Yes Yes button was selected.
7 %MsgResult_No No button was selected.

Example 1. Use button in style OK/ Cancel

&result = MessageBox(1, “Confirm OK / Cancel”, 0, 0, “Confirm OK / Cancel”);
rem WinMessage(%MsgResult_OK, 0);
If &result = %MsgResult_OK Then
WinMessage(“OK”, 0);

/* — each statment in peoplecode–*/
Else
WinMessage(“Cancel”, 0);

/* — each statment in peoplecode–*/
End-If;

 

Description of example 1

The PeopleCode &result = MessageBox(1, “Confirm OK / Cancel”, 0, 0, “Confirm OK / Cancel”); shows image below 

If you press the OK button then shows an image below

 

Ref : https://docs.oracle.com/cd/E28394_01/pt852pbh1/eng/psbooks/tpcl/chapter.htm?File=tpcl/htm/tpcl02.htm%2337ee99c9453fb39_ef90c_10c791ddc07__3ce0

How to use Peoplecode While Fetch

How to use Peoplecode While Fetch

How to use Peoplecode While Fetch of peoplesoft. You can use function while with fetch data from sql for get data from sql.

Local SQL &SQL_DM = CreateSQL( ” SELECT MANAGER, NAME FROM TABLE “);
&i = 0;
While &SQL_DM.Fetch(&MANAGER,&NAME );

/* Do statement*/

End-while;

Dynamic View in Peoplesoft

Dynamic View in Peoplesoft

You can use Dynamic View in Peoplesoft for each purpose such record in grid or scroll area of peoplesoft page or prompt table for search record.

Dynamic view in peoplesoft page

Step1 1 : Create dynamic view and assign it to grid or scroll area

Step 2 :  Create sql for flush data to dynamic view in grid or scroll area

Step 3 :  Populate data to grid/ scroll area by scrollflush & scroll select

Dynamic view for prompt table

You can read more about create dynamic view table and assign record field properties is prompt table from dynamic view and assign dynamic sql by peoplecode at here.

Step by step dynamic view peoplesoft

1. select fields for your table for use dynamic view prompt table

2. Choose record type  = Dynamic View

3. Click to open SQL editor and past sql in record

4. Define prompt table in derived field

5. Past peoplecode of RC of each purpose

You can define peoplecode in sql text by this syntax at below.

DERIVED_CTR.RC.SqlText = ExpandSqlBinds(FetchSQL(SQL.SQL_RC_FILTER), &RC_CODE);

Another way for dynamic table in peoplesoft by using EDITTABLE

1. Select Edits tab of record field and then select Table Edit.

2. Select Prompt table with edit( or No Edit) and past %EDITTABLE in prompt table.

3 : Place field DERIVED.EDITTABLE on the page peoplesoft.
4 : Write code in field change event of purpose field of each requirement.

 

How to Hide/ Disable Delete Button in Scroll Area or Grid Area by PeopleCode of Peoplesoft

How to Hide/ Disable Delete Button in Scroll Area or Grid Area by PeopleCode of Peoplesoft

How to Hide/ Disable Delete Button in Scroll Area or Grid Area by PeopleCode of Peoplesoft. 

If you grid area or scroll area in level 1 on page peoplecode and do not show delete button on grid some row of record by condition. You can function in peoplecode is DeleteEnabled for hide or show it by condition.

Grid area level 1 in Page

You can hide delete button all row by peoplecode

Local Rowset &rs0, &rs1, &rs1_1, &level1, &level2;

&rs0 = GetLevel0();
&rs1 = &rs0.GetRow(1).GetRowset(Scroll.TABLE_TEST);
&rs1.DeleteEnabled = False;

Result of grid view that hide delete button all row

 

 

 

 

 

You can hide delete button some row by peoplecode

Local Rowset &rs0, &rs1, &rs1_1, &level1, &level2;

&rs0 = GetLevel0();
&rs1 = &rs0.GetRow(1).GetRowset(Scroll.TABLE_TEST);

For &i = 1 To &rs1.ActiveRowCount
If &i = 3 Then
&rs1(&i).DeleteEnabled = False;
End-If;

End-For;

Result of grid view that hide some delete button

if you don’t ues peoplecode for hide all delete button. You hide all delete button by goto

Grid Properties > click tab Use > Click check box at No Row Delete

Table of Label Field Name in Peoplesoft

Table of Label Field Name in Peoplesoft

Select label name of filed data in sql of peoplesoft. Table of Label Field Name in Peoplesoft can use this sql.

select * from PSDBFLDLABL

/*–Label of field in Language –*/

select * from PSDBFLDLABLLANG

Translate Values Table Name in Peoplesoft

Translate Values Table Name in Peoplesoft

Select translate values data in sql for Translate Values Table Name in Peoplesoft

select * from PSXLATITEM

/*–Translate Value Lanquage –*/

select * from PSXLATITEMLANG

 

psxlatitem in peoplesoft is a table for store value of translate value of the field.  psxlatitem has related language record is PSXLATITEMLANG and parent record is PSXLATDEFN.

You can select a value of translate value by using below code of PeopleCode.

SELECT XLATLONGNAME FROM PSXLATITEM WHERE FIELDNAME =’TYPE’ AND FIELDVALUE= ‘1’;

SELECT XLATLONGNAME FROM PSXLATITEMLANG WHERE FIELDNAME =’TYPE’ AND FIELDVALUE= ‘1’;

How to use Peoplesoft Gethtmltext in Peoplecode

How to use Peoplesoft Gethtmltext in Peoplecode

You use GetHTMLText function about get html area and pass parameters to html dynamic html area by peoplecode

Requirement : Show the number of employees by age range

Step 1: Create HTML Template

Step 2 : Create HTML in Application Designer

Navigate : File > New > HTML

and copy & past code HTML and save name HTML = AGE_HTML

<table style=”width: 474px;” border=”0″ cellspacing=”0″ cellpadding=”0″>
<tbody>
<tr>
<td style=”width: 159px;”>
<table style=”line-height: 20.8px; width: 190px;” border=”1″ cellspacing=”1″ cellpadding=”1″>
<tbody>
<tr>
<td><span style=”font-size: 12px;”><strong>%bind(:1)</strong></span></td>
</tr>
<tr>
<td style=”background-color: #33ccff;”><span style=”font-size: 12px;”><strong>%bind(:2)</strong></span></td>
</tr>
<tr>
<td style=”background-color: #33ccff;”><span style=”font-size: 12px;”><strong>%bind(:3)</strong></span></td>
</tr>
<tr>
<td style=”background-color: #ff99cc;”><span style=”font-size: 12px;”><strong>%bind(:4)</strong></span></td>
</tr>
</tbody>
</table>
</td>
<td style=”width: 74px;”>
<table style=”line-height: 20.8px; width: 280px;” border=”1″ cellspacing=”1″ cellpadding=”1″>
<tbody>
<tr>
<td style=”background-color: #33ccff; width: 20px; text-align: left;” colspan=”2″><span style=”font-size: 12px;”><strong>%bind(:5)</strong></span></td>
</tr>
<tr>
<td style=”background-color: #33ccff; width: 20px; text-align: left;” colspan=”2″><span style=”font-size: 12px;”><strong>%bind(:6)</strong></span></td>
</tr>
<tr>
<td style=”background-color: #33ccff; width: 20px; text-align: left;” colspan=”2″><span style=”font-size: 12px;”><strong>%bind(:7)</strong></span></td>
</tr>
<tr>
<td style=”background-color: #ff99cc; width: 20px; text-align: left;” colspan=”2″><span style=”font-size: 12px;”><strong>%bind(:8)</strong></span></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>

Step 3 : Call  HTML by use GetHTMLText for call AGE_HTML by Peoplecode

Define Parameters for pass value to html code

&para1 = “Age Range”;
&para2 = “< 35”;
&para3 = “35-45”;
&para4 = “> 45”;
&para5 = “Number of Employee”;
&para6 = “25”;
&para7 = “36”;
&para8 = “8”;

TEST1_TBL.HTMLAREA = GetHTMLText(HTML.AGE_HTML, &para1, &para2, &para3, &para4, &para5, &para6, &para7, &para8);

You can past this code in anywhere by your requirement such as page activate  or component peoplecode

Show result HTML after pass parameter

 

 

How to Use scrollselect in Peoplecode

How to Use scrollselect in Peoplecode

You can use scrollselect and scrollflush peoplecode function fro populate data in grid and scroll area for each requirements

For Example 1 :

Local Rowset &rs1_1, &rs1_2;

&rs1_1 = GetRowset(Scroll.TEST1_TBL);
&rs1_1.Flush();
&rs1_1.Select(Record.TEST1_TBL, “where EMPLID = :1 and EFFDT = :2 order by To_Number(EMPLID ) “, &EMPLID , &EFFDT);

&rs1_2 = GetRowset(Scroll.TEST2_TBL);
&rs1_2.Flush();
&rs1_2.Select(Record.TEST2_TBL, “where EMPLID = :1 “, &Emplid);

/*– You can Sort Effdt in Scroll Area –*/
SortScroll(1, Record.TEST1_TBL, TEST1_TBL.EFFDT, “A”);

/*– Hide Row of  TEST1_TBL–*/

Local Rowset &VET_SCROLL, &OWNER_SCROLL, &PET_SCROLL, &VISIT_SCROLL;

/*Get level 0 Rowset*/
&VET_SCROLL = GetLevel0();

/*Now get level 1*/
&OWNER_SCROLL = &VET_SCROLL.GetRow(1).GetRowset(Scroll.TEST2_TBL);

/* The way to read this is at level 0 row 1 get the Rowset for the SCROLL OWNER and call it &OWNER_SCROLL. Now lets get level 2 at row  number = 5 and hide this row of level2 */

&PET_SCROLL = &OWNER_SCROLL.GetRow(5).GetRowset(Scroll.TEST2_2_TBL);
&PET_SCROLL.HideAllRows();

For Example 2 :

Scrollflush(Scroll.TEST1_TBL)
/* Populate Data of Grid Level 1*/
Scrollselect(1,Record.TEST1_TBL,Record.TEST1_TBL,”where EMPLID = :1 and EFFDT = :2 order by To_Number(EMPLID ) “, &EMPLID , &EFFDT);

Scrollflush(Scroll.TEST2_TBL)
/* Populate Data of Grid Level 1*/
Scrollselect(1,Record.TEST2_TBL,Record.TEST2_TBL,”where EMPLID = :1 “, &Emplid);