How to use substring in PeopleCode

How to use substring in PeopleCode

How to use substring in PeopleCode of each requirement. I have requirement select data from a parameter in a page that contains EMPLID, RC code and year. After user input parameter then retrieves data in grid or scroll area. I using this below PeopleCode.

If %page =’PAGE_NAME’ then

if all(recordname.emplid) then
&wheretxt = &wheretxt | “and emplid = ” | Quote(recordname.emplid);
end-if;

if all(recordname.RC_CODE) then
&wheretxt = &wheretxt | “and RC_CODE= ” | Quote(recordname.RC_CODE);
end-if;

if all(recordname.YEAR) then
&wheretxt = &wheretxt | “and YEAR= ” | Quote(recordname.YEAR);
end-if;

if all(&wheretxt ) then
&wheretxt = Substring(&wheretxt, 4, Len(&wheretxt));
&wheretxt = ” where ” | &wheretxt;
rem WinMessage(&wheretxt, 1);
end-if;

ScrollFlush(Record.recordname);
ScrollSelect(1, Scroll.recordname, Record.recordname, &wheretxt);
SortScroll(1, Record.recordname, recordname.EMPLID, “A”);

end-if;

How to use Rich Text Format in PeopleSoft

How to use Rich Text Format in PeopleSoft

How to use Rich Text Format in PeopleSoft in application designer.

You can input detail of requirement in record field long PeopleSoft.

1. Enable Rich Text of long field in application designer.

2. Save Detail

3. Use Detail of 2 by select long filed in the database and define value.

If &Datalong is data that select from your database.

Example: Record.Long_filed = &Datalong;

 

Messagebox Syntax in PeopleCode

Messagebox Syntax in PeopleCode

Messagebox Syntax in PeopleCode of PeopleSoft for popup message has many styles of each requirement.

MessageBox Syntax

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

where param list is an arbitrary-length list of parameters of undetermined (Any) data type to be substituted in the resulting text string, in the form:

param1 [, param2]. . .

Description

Use the MessageBox function to display a message box window. This function combines dialog-display ability with the text-selection functionality of MsgGet, MsgGetText, or MsgGetExplainText. The style parameter selects the buttons to be included. title determines the title of the message.

For Example :

MessageBox(1, “”, 0, 0, “Messagebox use value of style box = 1”, “”, “”);

More Example Click Here

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

How to Check Record is Changed in PeopleCode

How to Check Record is Changed in PeopleCode

How to Check Record is Changed in PeopleCode in scroll level 1 and level 2 and more level

For example check record is changed in level 1 by use peoplecode function IsChanged() in the event action of SavePreChange.

Example 1

Local Rowset &Level0_ROWSET, &LEVEL1_ROWSET;
&Level0_ROWSET = GetLevel0();
For &I = 1 To &Level0_ROWSET.ActiveRowCount

If RecordChanged(Record.CONTRACTS, CurrentRowNumber()) Then
rem WinMessage(“Changed row message from level one.”, 64);
CONTRACTS.LAST_EMPLID.Value = %OperatorId;
CONTRACTS.LAST_UPDATE_DTTM1.Value = %Datetime;
End-If;
End-For;

Example 2

or copy code at here

Local Rowset &Level0_ROWSET, &LEVEL1_ROWSET;

If %Page = Page.CONTRACTS Then

&Level0_ROWSET = GetLevel0();
For &A0 = 1 To &Level0_ROWSET.ActiveRowCount

/***************************/
/* Process Level 1 Records */
/*————————-*/
If &Level0_ROWSET(&A0).ChildCount > 0 Then
For &B1 = 1 To &Level0_ROWSET(&A0).ChildCount
&LEVEL1_ROWSET = &Level0_ROWSET(&A0).GetRowset(&B1);
For &A1 = 1 To &LEVEL1_ROWSET.ActiveRowCount
If &LEVEL1_ROWSET(&A1).GetRecord(1).IsChanged Then
rem WinMessage(“ischanged”, 0);
CONTRACTS.LAST_EMPLID.Value = %OperatorId;
CONTRACTS.LAST_UPDATE_DTTM1.Value = %Datetime;
End-If;
End-For;
End-For;
End-If;
End-For;
End-If;

More example of level 2 and level 3 from below reference: https://docs.oracle.com/cd/E80738_01/pt854pbh2/eng/pt/tpcd/concept_UnderstandingDataBufferClassesExamples-074aee.html#topofpage

Keeping Leading Zeros in excel/CSV by peoplecode

Keeping Leading Zeros in excel/CSV by peoplecode

Keeping Leading Zeros in excel/CSV by peoplecode in app engine or AE. You can use below sql code before write file in peoplecode.

This syntax for convert number to text for solve issue leading zeros

‘=””‘|| REPORTS_TO ||'””‘ 

 

e.g.   select jb.emplid  ,’=”‘||jb.reports_to||'”‘ from ps_job jb

 

Ref: https://it.toolbox.com/question/writing-data-into-csv-file-through-app-engine-peoplecode-100112
Ref:http://www.compshack.com/peoplecode/leading-zero-issue-csvexcel-formatterd-report

Bypass Search page in a Component

Bypass Search page in a Component

Bypass Search page in a Component

1. You can use function peoplecode setsearchdialogbehavior(0)  at searchinit keyfield for bypass search record.

  • setsearchdialogbehavior(0)  for skip if possible search record
  • setsearchdialogbehavior(1)  for force display search record

2. Use search record is INSTALLATIION

or use record no search key or Derived/Work record

 

More detail about search record dialog box of the component

Force Search Processing 

  • If select the Checkbox then even if the above conditions are true, the system will always display the search dialog box.
  • Clear Checkbox Force Search Processing (The Default is cleared)
  1. If all required keys have been provided (either by system defaults or by PeopleCode).
  2. If this an Add dialog box, then no “duplicate key error” results from the provided keys; if this error occurs, the processing resets to the default behavior.
  3. If this is a Search dialog box, then at least one row is returned based on the provided keys.

 

Reference: http://peoplesoftexperts.blogspot.com/2006/01/how-to-skip-search-dialog-box_04.html

Different between dosave and dosavenow in peoplecode

Different between dosave and dosavenow in peoplecode

Different between dosave and dosavenow in peoplecode function of peoplesoft.

Dosave =

For example 1 PeopleCode:

PeopleCode Statment 1
PeopleCode Statment 2
Dosave() / Dovenow()
PeopleCode Statment 3

In case of Dosave function PeopleCode Statment 1 to PeopleCode Statment 2  will execute then save processing will trigger and DoSave can be used only in FieldEdit, FieldChange, or MenuItemSelected PeopleCode.

And in case of DosaveNow function PeopleCode Statment to PeopleCode Statment 2 will execute then save processing will trigger and rest PeopleCode Statment 3 will execute after save. Save processing (including SaveEdit, SavePreChange, SavePostChange, and Workflow PeopleCode)

More Detail

Do savenow()–>save the current field/component immediately..

Example 2: in the main page having some fields
1. emplid
2. status
3. rccode
4. deptid
…etc

when you are enter first field value as 100 and immediately tab out of that field, 100 value saved in database. when you are writing dosavenow() function in field edit event.

do save() —> save the current component..just like clicking on save button…
Example 3: when you enter all field values in the page finally click on save button, that time only those values saved in database.

When you use save button instead save of component then peoplecode both set component changed and do save in field change event.

setcomponetchanged();
dosave ();

 

Ref: https://it.toolbox.com/question/dosave-and-dosavenow-090607
Ref: https://docs.oracle.com/cd/E13292_01/pt849pbr0/eng/psbooks/tpcl/chapter.htm?File=tpcl/htm/tpcl02.htm
Ref: http://www.compshack.com/forum/peoplesoft/peoplesoft-technical/difference-between-do-save-and-do-save-now-functions-peoplecod

How to transfer a page from one component to a page in another component

How to transfer a page from one component to a page in another component

How to transfer a page from one component to a page in another component by peoplecode function in peoplesoft

Transfer function for transfer page from one page to the other page in difference component/ current component.
Syntax of transfer
Transfer(new_instance, MENUNAME.menuname, BARNAME.barname, ITEMNAME.menu_itemname, PAGE.component_item_name, action [, keylist] [, AutoSearch]);

Example : Transfer(true, MENUNAME.ADMINISTER_PERSONNEL, BARNAME.USE, ITEMNAME. PERSONAL_DATA, PAGE.PERSONAL_DATA_1, “U”);

TransferExact(new_instance, MENUNAME.menuname, BARNAME.barname, ITEMNAME.menu_itemname, PAGE.component_item_name, action [, keylist] [, AutoSearch])

For example PeopleCode

 

Use the TransferExact function to close the current page and transfers the user to another page, either within the current component or in another component. TransferExact can either start a new instance of the application and transfer to the new page there, or close the old page and transfer to the new one in the same instance of PeopleTools.

Ref:https://docs.oracle.com/cd/E80738_01/pt854pbh2/eng/pt/tpcl/langref_PeopleCodeBuilt-inFunctionsAndLanguageConstructs_T.html#topofpage

Difference between transfer and transferpage in PeopleSoft

Difference between transfer and transferpage in PeopleSoft

Difference between transfer and transferpage in PeopleSoft by PeopleCode language is function transfer page for each purpose.

TransferPage (): For transfer page from one page to the other page within a component.
Syntax of TransferPage
TransferPage([PAGE.page_name_name])
Example: TransferPage(PAGE.JOB_DATA);

Transfer(): For transfer page from one page to the other page in difference component/ current component.
Syntax of transfer
Transfer(new_instance, MENUNAME.menuname, BARNAME.barname, ITEMNAME.menu_itemname, PAGE.component_item_name, action [, keylist] [, AutoSearch]);

Example : Transfer(true, MENUNAME.ADMINISTER_PERSONNEL, BARNAME.USE, ITEMNAME. PERSONAL_DATA, PAGE.PERSONAL_DATA_1, “U”);

new_instance =  true = new window, false= current window.

You can find menu name, bar name, item name and  component_item_name  by select data in table PSAUTHITEM

Action =  A –Add,  U-update, L-Update/display, C-Correction, E-Data Entry

AutoSearch = Specify whether an automatic search on the target search page is executed after the transfer. This means the search results are already shown without the end-user having to click the Search button.
True=  an automatic search.
False = User has to click the search button.

 

Ref: http://peoplesoftismail.blogspot.com/p/normal-0-false-false-false-en-us-x-none_5886.htm

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