Decode, If, Case statements in SQL

Two examples of evaluating 2 values and returning a given value based on which is earlier/bigger:

DECODE((SYSDATE - A.DUE_DT) - ABS(SYSDATE - A.DUE_DT), 0, 'OVERDUE', A.DUE_DT) AS DUE_DATE
CASE WHEN SYSDATE > A.DUE_DT THEN 'OVERDUE' ELSE to_char(A.DUE_DT) END AS DUE_DATE


Both do the same thing.

Related links:
http://www.4guysfromrolla.com/webtech/102704-1.shtml
http://www.sqlteam.com/article/the-case-for-case

Passing Parameters to SQR via the Process

10.01.2008, update: seems Blogger has lost the uplaoded images for this post. Perhaps they will come back?

Update the Parameter List of your process definition. I this case I have used a Record.Field value.





PeopleCode to set the value of the Field (GU_GRDLPS_RC_WK.DESCR).





In your SQR you pick up the parameter by using the Input statement:


input $procAcadOrg 'Academic Organisation to distribute report to: (Optional, Press ENTER to continue)'

Errors running Application Engines

If you get the following error:

"Message:
All Processing Suspended: Restart OPRID=S390765, RUNID=31-01-03112240, PI=2988

Description:
A pending process was found for the current Operator id, Run Control id, and Application Engine Program. This process either is running now or has abended. Please restart the pending process if it has abended, and allow it to run to completion, before submitting a new process request."


...you need to cleanup the dead rows in sysadm.ps_aeruncontrol.

PeopleTools > Application Engine > Manage Abends




Downloading from Grids - IE settings

Problem:
We found a problem when tring to download to spreadsheets from grids. IE wouldn't open the spreadsheet, just refreshed a few times and then nothing.

Resolution:
Tools/Internet Options/
Security/Custom Level/
Downloading/Automatic prompting for downloads - tick enable.

Bad CSV layout from SQR

I found that some CSVs had layout problems where the file being produced contained unwanted line breaks. This of course mucked up the layout when the CSV was viewed in Excel or whatever.

I added the following to the top of the SQR:

begin-setup
page-size 79 600
end-setup

The page-size command sets the number of rows and columns, respectively (rows weren't an issue).

Edit: In latest version of SQR use the following:

   Declare-Layout my-layout
     paper-size=(a4)       
     orientation=landscape
     MAX-COLUMNS=600
   End-Declare
                                
   Declare-Report THIS_REPORT
      Printer-Type=POSTSCRIPT
      LayOut=my-layout
   End-Declare    


Prompts driven by other prompts

Sometimes you want to be able to filter the values returned by a prompt based on a value you have entered on another prompt on the page. For example you have selected 'Australia' in the first prompt and now you want the second prompt to only list states for that country.

This example uses Pay Groups and Run Types:
When the user has selected a 'Pay Group' the prompt for 'Run Type' will only return run types that are in that pay group:






The first record stores the values, in this case it has no keys.
Note the key structure and list items on the two prompt records:

Component Interfaces - What they can't do.

The DoSaveNow() PeopleCode function does not trigger when run from a Component Interface. There is no indication, error or warning. There may be other misleading errors or warnings caused by the DoSaveNow() not being triggered.