Friday, March 15, 2013

What KPI Really means

Here is an interesting post from MiproConsulting When KPI Really Means “Keep Profits Increasing” (Hint: It Always Does)

Thursday, March 7, 2013

Deleting files in a folder using PeopleCode

Almost everyday I spent some time to go through the posts in various PeopleSoft forums like ITToolbox. This helps me to learn new things, I can help others and get help when needed.

Similar to my previous post, this is also related to a question asked on this forum.

Question: How to delete a file through peoplecode through AE process?

Answer: Here is the PeopleCode which will do this.

 Local array of string &fNames;  
 Local file &myFile;  
 Local String &dir;  
 &dir = 'F:\Temp\' | %DbName | '\Email\UTI0XX\*';  
 &fNames = FindFiles(&dir, %Filepath_Absolute);  
 While &fNames.Len > 0  
 For &i=1 to &fNames.Len  
 &myFile = GetFile(&fNames.[&i], "w", %Filepath_Absolute);  
 &myFile.Delete();  
 End-For;  
 End-while;  

PeopleCode as Plain Text

Until recently I didn't realize that there is a table storing PeopleCode as plain text in recent PeopleTools versions. Table name is  PSPCMTXT. Find In feature of Application Designer has been troublesome when the scope of the search is broader hence this new table would make the life of developer much easier when searching for text in PeopleCode. I guess this was introduced from PT 8.5 onwards.

One point to note is that when the PeopleCode text is large in size, it is divided into multiple chunks and stored as multiple rows of data in this table.

Tuesday, March 5, 2013

How to check if a file is editable in PeopleCode

How do we check if a file is editable in PeopleCode? This was a question asked in ITToolbox forum.

We can do this easily using Java File class object.



 &myFileToCheck = "C:\Temp\MYFILE.TXT";  
 Local JavaObject &file = CreateJavaObject("java.io.File", &myFileToCheck);  
 If &file.canWrite() Then  
   /*Normal processing*/  
   MessageBox(%MsgStyle_OK, "", 0, 0, "File is editable!!");  
 Else  
   /*Error processing*/  
   MessageBox(%MsgStyle_OK, "", 0, 0, "File is Read Only!!");  
 End-If;