Search This Blog

Thursday, January 24, 2013

Component Properties: Difference between Search Record and Add Search Record

Below are the Search records we can add through Component properties.


Search Record Name
 Displays the component's default search record when you access the component in update or display mode.

Note. You can assign an override search record to a component at the menu level. If the component uses an override search record, the search record displayed in the Override Search Record will be different from this one and you should search it instead.

Add Search
 Displays the component's search record when you access the component in add mode.


Source of above information: Peoplebooks

When to use Add Search Record?
 In a case where we want to control the data that should be added or for a requirement where we add a counter for the ID.

Lets see a simple example where the Search record and Add Search record is used.

The below Events page helps us to create different types of  Campus Events.

Let's first see how this page works.

Search shows us the list of Campus Events available.
Lets see the data for Event ID 000010005.

 Now, Lets Add a New Event ID. In this case , we use a different Search record because we need to setup a new Event ID.





  Lets see how we can do this in App Designer.

  Below is strucuture of these search records.
 The Standard Search record is a view which retrieves data from primary record of the component.
 For Add Search record, Primary record of the component is used. The EventID is set to '0'  at fielddefault peoplecode. Once the page is saved, the peoplecode in the SavePrechange event will get the most recent Event ID and then adds plus 1. (i.e if recent EventID is 121 ,then new Event ID will be 121 +1 = 122)




Friday, January 11, 2013

Difference between key , duplicate order key , Alternate Search key

Record Field Properties:

Difference between key , duplicate order key , Alternate Search key

Key:
  •     Helps us in uniquely identifying a row of data.
  •     The primary key must be the first field in the record, followed by the next most important key, and   so on.
  •     Key fields are followed by duplicate order keys, in order of importance, then by fields that are not keys.
  •     Can be used as Search key or listbox item or both.
Duplicate order key
  • Allows duplicate values.
                Example. Same Employee having multiple degrees at same date.
  • Do not create a related language record with a duplicate order key.
  • Can be used as listbox item.
Alternate Search key 
  •  This displays the field in the Advance Search and builds indexes on this field. 
  •  This will help in fast retrieval of data.
  •  Also keep in mind that, as these database indexes consume disk space, mark the field alernate search  key only if it is really required.
  •  Alternate key fields can be placed anywhere among regular fields (non-key fields), in any order. They do not need to be grouped.
  •  It is displayed in the Advanced search and can be used as Listbox item.
All these 3 keys are mutually exclusive.

Sunday, August 19, 2012

App Designer Login Issues

Problem: Not able to change peopletools objects from App designer.
Resolution: Need to add "PeopleSoft Administrator" role to the userid.

Problem: Invalid username/password while logging to App designer.
Resolution: check the TNS entries placed in Orahome (Place where oracle software is installed) /network/admin folder. See that the SID , port and domain are correct.

Problem; Want to change the default PS logo.
Resolution: One quick way is to create an image object of same dimension (usually 145 x 41) , and upload through App designer.



Friday, March 9, 2012

Hiding a row in a grid

&rs(&i).visible=false;

"rs" is the rowset of the grid. i.e &rs = getrowset(sroll.RECNAME);
"i" -- represents row of the grid.
 Let us take a scenario where we want to hide employee rows who are contractors
Sample grid data
Sno   Emplid  Name  EmpType
1       14201   Kiran      P 
2       14202   Krishna  C
3       14203   Ravi       P   

Now , I want to hide Contractor. In this case it is Krishna.
So I will traverse through the rowset

Buffer values of the grid before hiding the rows.
1 Kiran
2 Krishna
3 Ravi

for &i=1 to &rs.activerowcount

if  &rs(&i).EMP_HIRE_DTL.EMP_TYPE = "C" then
&rs(&i).visible = false; 
end-if;
end-for;

Buffer values of the grid after hiding the rows.

1 Kiran
2 Ravi
3 Krishna

Hope the above info is useful.

Tuesday, January 24, 2012

Extracting file details from unix into peoplesoft

There are some cases where we would like to get the File details like timestamp etc from unix server into peoplesoft.

There are different approaches that we can follow to get file details from unix file server.

1. Use Shell script and write file attributes like owner,filename,lastupddttm etc to another file and then
    call this script from peoplecode Exec function.
2. User shell script and write file attributes to database record and then call this record from peoplecode.
3. Use Java language file class concept. Like instantiate the Java file object and then call the javamethod from   peoplecode to get the file attributes.

Let us see the first approach.

1. Use Shell script and write file attributes like owner,filename,lastupddttm etc to another file and then
    call this script from peoplecode Exec function.
 a) Create a shell script and execute from server to check the correctness of the script.
     pseudocode:
     Get the file details using ls -ltr command and store the output to variable
     Write these variables to a file.
b)  since we need file attributes of a particular file from a particular env, pass the filename and env as input.
c)  Use exec command from peoplecode and execute the script.
One challenge is in getting the file datetime values. In unix, ls -ltr will give file datetime till hours and mins but not secs.
Example: Abc.txt  Jan 14 5:29 but there are chances file might get overriden during the same time like 5:29 14 secs might get overriden at 5:29 42 secs. We cannnot find this using the ls -ltr command.  
To overcome this , use the perl script which will give the time till secs.

Thus we can get the file attributes from the above steps. Hope the info is useful.






Preserve case parameter in addattachment function

Below post is helpful to those who have encountered an issue with the file extension getting converted to lower case  instead of retain the same.

We use add_attachment(list_of_param....) to upload files to the server.
Inside the Add_attachment(list_of_param....) function there is a builtin library function addattachment(list_of_param....) which actually uploads the file in the server.

There is one parameter called preserve case which helps to retain the extension which user had uploaded.
By default, it is set to false.
That means if user uploaded "Test_File.TXT" , the file name on the server will be "Test_File.txt".

There could some cases where you feel the extension of the file should not change.
In that case , change the value to 'true'.

AddAttachment(URLDestination, DirAndFilename, FileType, UserFile[, MaxSize]                                                                     [, PreserveCase, UploadPageTitle])

Above syntax is from tools version 8.49


Tuesday, November 22, 2011

Using Dynamic View

Dynamic View:
'View' is nothing but a static sql that pulls data from atleast one record.
'Dynamic View' enables to pass values dynamically ( at runtime ) to the where clause.
Example:
Lets think of a page which has country and state fields.
RECA.COUNTRY -->RECORD.FIELD
RECA.STATE -->RECORD.FIELD
The state field prompt should show the list of states for the country selected in the Country field prompt.
That means the value of the state field depends on the value of the country field.
In this case , we can use dynamic view for the state field ( STATE ).
PS_STATE_DVW -- This should contain STATE as a key field and listbox item and leave the SQL definition as blank and Save.

Setting Record field properties in App designer.
Now add this Dynamic view as prompt to the record field STATE .
Until now , we have only defined that the STATE record will use the PS_STATE_DVW as Dynamic view. But we have not injected the SQL to this dynamic view to pull the required data.
Below is the code, which builds the SQL and attaches to the SQL Editor of the Dynamic view.
Now that the code is ready , we need to know where exactly to place this code? Since the user selects the 'Country value' from the country field , in the COUNTRY field , field change event we can place the below code.
/** Peoplecode Begin **/
/** This is the SQL string which is used to pull the states for a given country **/
&str = "select STATE from PS_CUST_CNTRY_TBL where COUNTRY = (:1) ";
/** ExpandSQLBinds will expand the &str and inserts the values into bind param **/
/** &sql_text_defn = "select STATE from PS_CUST_CNTRY_TBL where COUNTRY = 'IND'" assuming 'IND' is selected on the page. **/
&sql_text_defn = ExpandSQLBinds(&str, RECA.COUNTRY.value);
At this stage the SQL string is ready with its dynamic value (country).
Now, we need to pass this SQL string has to be injected to the Dynamic view SQL Text definition.
/** Passing the SQL string to the Dynamic view **/
RECA.STATE.sqltext = &sql_text_defn;
/*** Peoplecode End ***/
In the PIA, now once we select 'IND' for country field and select on STATE prompt, all states for given country will be listed.
This completes the usage of Dynamic View.