Hi,
Here we are going to learn how to access the data on the pages and component in PeopleSoft.
So here we go, first of all you should know what is component buffer and data buffer.
We have 2 references for this:
- Component buffer: http://docs.oracle.com/cd/E55243_01/pt854pbr0/eng/pt/tpcd/concept_UnderstandingComponentBufferStructureandContents-074b09.html
- Data buffer:
https://docs.oracle.com/cd/E41633_01/pt853pbh1/eng/pt/tpcd/concept_UnderstandingDataBufferAccess-074af2.html
You can read these 2 references, but to better understand we can say that a component buffer is a part of PeopleSoft memory to store each users currently accessed component and its related data.
And data buffer is part where other data is stored which is not stored in component buffer i.e. arrays, variables etc.
Here what we basically do is access the component buffer.
So in the component buffer link you must have noticed that there are 2 methods to access the data in component buffer:
- Contextual references
- References through scroll path
So here’s what we talk about the methods. Let’s go for second method first.
Let’s take an example of USERMAINT component, yes the very same page to update the user profile, add roles and maintain user information.
Navigation: Main Menu-->PeopleTools-->Security-->User Profiles-->User Profiles
Ok, let’s talk about the General tab, say we need to check out if the account is locked out or not.
Let’s make it a bit interesting.
We add a new message popup at the component load where it will say that the account of the person is locked out and please verify if the person is active in the organization.
To do this we need to add the PeopleCode in the correct event. (Considering that you know about PeopleCode events)
We will add the code in Component PostBuild event, why so, because this is the event where all the data of the component is loaded in to the buffers, so making use of this event is most expected in this situation.
Let’s go ahead with writing the code.
If GetLevel0()(1).GetRecord(Record.PSOPRDEFN).GetField(Field.ACCTLOCK).Value = 1 Then MessageBox(0, "", 0, 0, "This Account is locked, please confirm the user is not active in the organization"); End-If;
You must be thinking about the functions/methods we have used in this code. Here are the descriptions of some of em’:
- GetLevel0(): this function will fetch the Level 0 RowSet object of the component.
As this is the base rowset of the component it will have only one row, so to extract that row we need to use GetRow(<ROW-NUMBER-STARTS-WITH-1>) i.e. GetRow(1), this we can also use as GetLevel0()(1). So we can use it as GetLevel0().GetRow(1) also. - GetRowSet(Scroll.<SCROLLNAME>): This function will get the RowSet object of preceding levels. i.e. level 1 to level 3 as PeopleSoft do not support more than 3 scroll levels, so nesting of more than 3 scroll levels cannot be done in a single component.
- GetRow(<ROW-NUMBER-STARTS-WITH-1>): This function will extract the specified row from the RowSet object. It can also be used as …GetRowSet(Scroll.<SCROLLNAME>)(< ROW-NUMBER-STARTS-WITH-1>) instead of …GetRowSet(Scroll.<SCROLLNAME>).GetRow(< ROW-NUMBER-STARTS-WITH-1>).
- I hope you must have got the idea of other 2 methods.
Ok now let’s traverse further in the roles grid/scroll. Oh and one more thing in case of levels the scroll and grid are the same thing.
We now write a code to see if this is an Administrator account or not. If it is, a message should popup to say that this is an admin account beware!!!
&roles = GetLevel0()(1).GetRowset(Scroll.PSROLEUSER_VW); For &i = 1 To &roles.RowCount If &roles.GetRow(&i).GetRecord(Record.PSROLEUSER_VW).GetFIELD(Field.ROLENAME).Value = "ADMINISTRATOR" Then MessageBox(0, "", 0, 0, "This is an Administrator account. Be Cautious!"); Break; End-If; End-For;
Now this code will trigger a message to the user if he opens up an administrator account for any modifications.
Now we talk about the first one.
This is very simple, you just have to use RowSet object property i.e. CurrentRowNumber.
This will get the current row number on whose field the PeopleCode is executing.
Let’s say for example there is a PeopleCode written on a FieldEdit of a record field.
So now if the record is used as a grid on some page/component, every time you update the field of any of the row, this will help you in determining the correct row to run the edits.
So this is all about buffers in PeopleSoft and now you are a master of component buffer and data buffer. Proceed with your development.
Enjoy!!!
This is very useful and got to learn much on this topic.
though m not very good in PS but still this post is very good and there are no posts that have this kind of useful learning.
thanks vipin… appreciate your efforts 🙂