Wednesday, December 11, 2013

Enable the Advanced search option in Prompt by default

Go the component and change the setting to default search behavior to Advance then Advance Search will come by default in prompt as well.

Wednesday, November 20, 2013

Update matching rows in one table with data from another table

Update matching rows in t1 with data from t2

update t1
set (c1, c2, c3) =
(select c1, c2, c3 from t2
 where t2.user_id = t1.user_id)
where exists
(select * from t2
 where t2.user_id = t1.user_id)

The "where exists" part it to prevent updating the t1 columns to null where no match exists.

Tuesday, November 12, 2013

Getting rid of invalid Tablespace references

Suppose you import a big project to a DB, and notice that a number of tables in the Project refer to invalid (non- existing) tablespaces.

One way of updating this would be from AppDesigner.
Open Table. Select Tools-> Data Administration-> Set Tablespace, and set the correct Tablespace

But in case you have a large number of records having this problem, and don't want to go through the pain of updating it one by one, here's a backend update that will help.
UPDATE PSRECTBLSPC set DDLSPACENAME='PTAPP', DBNAME='PSPTDMO' where DDLSPACENAME in (<INVALID TABLESPACE>)

Wednesday, October 30, 2013

HyperLink of a file in PeopleSoft page

Usually files are stored on the Application Server or in the database as attachments, since it is the application server that does the processing and not the webserver. It is common to place the file on the appserver or in the database.This is better manageable and movable between environments.

After placing the file on the appserver or in the database you can create a link on a page and use the ViewAttachment function to link to the file. ViewAttachment() retrieve the file from the server and show it to the user and it may require ftp to be configured for its paramater URL.

If you really want to place it on the webserver, you can add the file to the root of PIA, something like
[PS_CFG_HOME]\webserv\peoplesoft\applications\peoplesoft\PORTAL.war\myfile.htm
or
[PS_HOME]\webserv\peoplesoft\applications\peoplesoft\PORTAL.war\myfile.htm

Now you can access the file directly via the webserver by defining a url like
http:/<server>:<port>/myfile.htm

Monday, October 28, 2013

Rowset Flush() and Select()

&SELECT_STRING = "WHERE 1 = 1";

if [some condition] then
&SELECT_STRING = &SELECT_STRING | " AND YOUR_FIELD = '" | &Variable | "'";
end-if;
[more conditions/fields as required]

&RS1 = GetLevel0()(1).GetRowset(Scroll.YOUR_RECORD_VW);
&RS1.Flush();
&RS1.Select(Record.YOUR_RECORD_VW, &SELECT_STRING);

Wednesday, October 9, 2013

Messagebox Yes No button

REM - confirmation from user;
&n_Check = WinMessage(MsgGetText(0, 0, "Content can not be changed once saved. Do you want to Continue?"), 4);

If &n_Check <> 6 Then
   /* Cancel save */
   MessageBox(0, " ", 20000, 6, "Your content has not been saved");
End-If;


-------------------

&re = WinMessage(&job_SWHA, 1);

0 gives you 'OK'
1 gives you 'OK' and 'Cancel'
2 gives you 'Abort', 'Retry', and 'Ignore'
3 gives you 'Yes', 'No' and 'Cancel'
4 gives you 'Yes' and 'No'
5 gives you 'Retry' and 'Cancel'

The value of &re gives you which button user has selected.