Importing BI Publisher Sub-template to the Main Template for Testing local environment

Recently I was working on BI publisher RTF template and I had several Sub-templates to be included into the main template. Firstly, I wanted to test these Sub-templates locally before pushing it to development environment. I tried what PeopleBooks were suggested. The PeopleBooks says;
Testing a Sub-Template in Microsoft Word
You should test your template and sub-template using Template Builder before uploading to PeopleTools to make your sub-template is accessible to your template on the file system.
Use the following syntax when importing:
<?import:file:C:///Template_Directory/subtemplate_file.rtf?>
Notice the triple slashes and the use of the actual file name instead of template ID.
When your design is complete, you can change the import statement back to make the sub-template available to the main template in PeopleTools environment.
I followed the same syntax above. However, I could not work it out as I was having these errors when I try to preview the main RTF template as a PDF. After bit of a research I found out that I need to include these custom properties in the xdo.xfg file.
<property name="xdk-secure-io-mode">false</property>
<property name="xslt-scalable">true</property>
Meaning of each property and their values as follows;

How to read a field from a CSV file in to a PeopleSoft record (not in order) using File Layout

How to read a field from a CSV file in to a PeopleSoft record (not in order) using File Layout
If you want to read a csv file to PeopleSoft record in a sequential order you can use the following code to do that.
Local File &MYFILE;
Local Record &REC;
Local array of string &ARRAY;
Local string &STRING

&MYFILE = GetFile("c:\temp\vendor.csv", "R", %FilePath_Absolute);
&REC = CreateRecord(RECORD.MY_TEST_RECORD);
&ARRAY = CreateArrayRept("", 0);

If &MYFILE.IsOpen Then
   If &MYFILE.SetFileLayout(FILELAYOUT.MY_TEST_FILELAYOUT) Then
      While &MYFILE.ReadLine(&STRING);
         &ARRAY = Split(&STRING, ",");
         For &I = 1 To &REC.FieldCount
            &REC.GetField(&I).Value = &ARRAY[&I];
         End-For;
      /* do additional processing here for converting values */
         &REC.Insert();
      End-While;
   Else
      /* do error processing - filelayout not correct */
   End-If;
Else
   /* do error processing - file not open */
End-If;

&MYFILE.Close();

However, let's assume that you want to read a particular field or few fields from a CSV file to a PeopleSoft record. Then you can use another version of the above code. Here we can use an array object to store all the fields from the CSV and then you can use array index to find the particular field you are looking. Then, you can use SQLExec to insert or update that PS record you want.
Local File &MYFILE;
Local Record &REC;
Local array of string &ARRAY;
Local string &STRING
Local string &2ndFieldFromCSV

&MYFILE = GetFile("c:\temp\vendor.csv", "R", %FilePath_Absolute);
&REC = CreateRecord(RECORD.MY_TEST_RECORD);
&ARRAY = CreateArrayRept("", 0);

If &MYFILE.IsOpen Then
   If &MYFILE.SetFileLayout(FILELAYOUT.MY_TEST_FILELAYOUT) Then
      While &MYFILE.ReadLine(&STRING);
         &ARRAY = Split(&STRING, ",");
   /* lets assume that you want 2nd field from the csv file*/
          &2ndFieldFromCSV = &ARRAY[2];

      /* do additional processing here insert, update etc.. */
         SQLExec("UPDATE PS_MY_TABLE SET FIELD2 = &2ndFieldFromCSV WHERE PK_FIELD1 = 'SOME VALUE') ;
      End-While;
   Else
      /* do error processing - filelayout not correct */
   End-If;
Else
   /* do error processing - file not open */
End-If;

&MYFILE.Close();

Obviously, there are many ways to do the same thing in many different ways. But, leaveraging PeopleSoft File Layouts do the job will be much easier.


Become Awsome in PeopleSoft with these PeopleSoft Books

If you want to become awesome in PeopleSoft and want to take your PeopleSoft skills to the next level grab these awesome PeopleSoft books from PeopleSoft Tutorial.
Simply follow the links below;
  • PEOPLESOFT UPDATE MANAGER Buy Now
  • CREATE PEOPLESOFT REMOTE LAB Buy Now

How to Improve Interpersonal Skils in PeopleSoft Project Management

Whether you are a seasoned PeopleSoft Developer or Guru, or even an expert in PeopleSoft suite of technologies you have to deal with People all the time. Having good knowledge and understanding of stakeholders around you is inevitable in order to gain trust, mutual understanding and ultimately to achieve success in your PeopleSoft project. Here I'm going to list some of the most common interpersonal skills that you may need to enhance in your PeopleSoft career. This is a very short list so feel free to add any thoughts as a comment so that other visitors of this blog can get a value from it.

Interpersonal Skills in (PeopleSoft) Project Management [1]

Well developed technical, interpersonal and conceptual skills help to analyses the situation and interact appropriately.



1. Leadership

Leadership is an ability get things done through others. Respect and trust are the key elements of effective leadership. This is critical in beginning of the project which use to emphasis and communicate the vision and motivating and inspiring project participants to achieve high performance.

2. Team Building

Team building is the result of good leadership and team building is teamwork.

3. Motivation

Overall success of the project depends on the project team's commitment, which is directly related to motivation. Motivational factors in a project/team environment.
  • Self-satisfaction
  • Job satisfaction
  • Challenging work
  • A sense of accomplishment
  • Achievement and growth
  • Money
  • Other rewards and recognition

4. Communication

Single biggest reason for project success and failure. Effective communication and Openness in communication is a gateway to teamwork and high performance. It improves relationships among team members and create mutual trust.
Effective communication involves awareness of communication style, parties, cultural issues, relationships, personalities, and overall context of the situation.
Active and Effective Listening is a big part in good communication.

5. Influencing

According to [2] influencing is the power to change or affect someone or something. In project management Influencing is important to get things done through others in positive manner.

6. Decision Making

Six-Phase Decision making model

7. Political and Cultural Awareness

8. Negotiation

A successful negotiation may include;
  • Analyse the situation
  • Identify Difference between wants and needs - both their and yours
  • Focus on interests and issues
  • Ask for high and offer low but realistic
  • When you make and concession, act if you yield something
  • Make both parties feel they have won, Win-Win negotiation.
  • Active listening and articulating

References

[1] http://www.merriam-webster.com/dictionary/influence

[2]


How to use GetAttachment and PutAttachment PeopleSoft Builtin Functions

How to use GetAttachment and PutAttachment PeopleSoft Builtin Functions
A while ago I had a requirement to transfer attachments from a source FTP server location and store it into a database record. To do that you have to use GetAttachment and PutAttachment PeopleCode functions. Basically GetAttachment PeopleCode function can be used to download the attachment from its source storage location (say FTP or database record) to the application server and then you can use PutAttachment PeopleCode function to upload the attachment from the app server file system to the specified storage location (e.g. to a database record).

The GetAttachment and PutAttachment the function Parameters are as follows;

GetAttachment(URLSource, DirAndSysFileName, DirAndLocalFileName[, LocalDirEnvVar[, PreserveCase]])

PutAttachment(URLDestination, DirAndSysFileName, DirAndLocalFileName[, LocalDirEnvVar[, PreserveCase[, AllowLargeChunks]]])

The first parameter for the GetAttachment function is URLSource. This indicates the source location of the file. This can be implemented as a URL object with the form of URL.URL_ID. URL object is an identifier of the storage location including the protocol to be used (e.g. ftp) and the address of the storage location. URL objects can be created and maintained using URL maintenance page; PeopleTools > Adminstration > Utilities > URLs.
Length of the full URL is limited to 254 characters. For the file attachment functionality, in specifying the URL for the FTP server, the FTP server's machine name can be more than 30 characters, but the length of the full URL is limited to 120 characters.
Following protocol types can be used for the URLID
  • FTP
  • FTPS (FTP over SSL)
  • SFTP
  • HTTP
  • HTTPS
For plain FTP URL object can be referenced in one of the following formats;
  • ftp://<username>:<password>@<machinename> where the FTP user and FTP password are provided in clear text, but the URL information comes from the URL object. 
  • ftp://<username>@<machinename> where the FTP user is provided in clear text, but the FTP password and the URL information comes from the URL object.
    ftp://<machinename> where all the required information comes from the URL.

The first parameter for the PutAttachment function is URLDestination. This indicates the destination location of the file (in this case database record). An URL object can be create to indicate the database record you want to store the attachments.

Things to consider when storing attachments in the database

If the files are stored in a database table, PeopleSoft divided the files in to chunks before storing in to the database table. The chunk size is governed by the value of the Maximum Attachment Chunk Size field on the PeopleTools Options page (PeopleTools > Utilities > Administration > PeopleTools Options). 
As an example you can use this PeopleCode to Get and Put attachments as follows;

Local number &retCodeGet, &retCodePut;
   &retCodeGet = GetAttachment(URL.TEST_URL, "test_123.pdf", "Example_test.pdf");
   If &retCodeGet = %Attachment_Success Then
      &FileName = "Example_test.pdf";
      &retCodePut = PutAttachment(URL.ATTACHMENT_DB_REC, &UniqueName, &FileName);
      If &retCodePut = %Attachment_Success Then
         WinMessage("Put Att Success: " | &retCodePut);
      Else
         WinMessage("Error occurred in Put Att: " | &retCodePut);
      End-If;
   Else
      WinMessage("Error occurred in Get Att: " | &retCodeGet);
   End-If;