Tuesday 30 December 2014

Send Mail with Multiple Attachments using PT_MCF_MAIL

Using an Application Engine, I want to attach multiple attachments to an outgoing email.

Combine both for Record PeopleCode usage.

Friday 26 December 2014

Setup Custom Page for File Upload

First, create a record.

From this point forward, we will refer to it as MYRECORD.

Next, create the page.

Tuesday 23 December 2014

SQL - Extract Month, Day, or Year from Date Value

Happy Holidays!

SELECT 
extract(YEAR from SYSDATE) as Year, 
extract(MONTH from SYSDATE) as Month, 
extract(DAY from SYSDATE) as Day
FROM DUAL;

Friday 19 December 2014

SQL - GRANT Access to Record

I want to grant SELECT, UPDATE, DELETE, or all of these to a record.

Fire up Data Mover:

  1. Application Designer > Go > Data Mover
  2. or
  3. \Pt848\bin\client\winx86\psdmt.exe
SET LOG C:\TEMP\GRANTLOG2014.LOG;

GRANT ALL ON SYSADM.PS_MYRECORDNAME TO myusername;

Tuesday 16 December 2014

SQL - Using OVER (PARTITION BY)

I want to list all phone numbers for a specific employee in one row.

Let's look at my progress with the OVER PARTITION command.

SELECT A.EMPLID, B.PHONE, ROW_NUMBER() OVER (ORDER BY A.EMPLID) as SEQ
FROM PS_PERSON A, PS_PERSONAL_PHONE B
WHERE B.EMPLID = A.EMPLID;

Results:

Now we add PARTITION BY EMPLID

Friday 12 December 2014

DateTime Format

This is for SQL.

SELECT TO_CHAR(AUDIT_STAMP, 'yyyy-mm-dd hh24:mi:ss')
FROM PSAUDIT;

And this is using PeopleCode.

DateTimeToLocalizedString(%Date, "yyyyMMdd");

Tuesday 9 December 2014

Find Portal Navigation Using Component Name

I want to find the navigation path using only a Component name.

Simple SQL

SELECT LEVEL0.PORTAL_LABEL || ' > ' || LEVEL1.PORTAL_LABEL || ' > '  || LEVEL2.PORTAL_LABEL || ' > '  ||  level3.PORTAL_LABEL PATH_TO_COMPONENT
FROM PSPRSMDEFN level3
, PSPRSMDEFN level2
, PSPRSMDEFN level1
, PSPRSMDEFN LEVEL0
WHERE level3.PORTAL_URI_SEG2 = "Your Component Name"
AND level3.PORTAL_PRNTOBJNAME = level2.PORTAL_OBJNAME
AND level2.PORTAL_PRNTOBJNAME = level1.PORTAL_OBJNAME
AND level1.PORTAL_PRNTOBJNAME = LEVEL0.PORTAL_OBJNAME
AND level3.PORTAL_NAME = level2.PORTAL_NAME
AND level2.PORTAL_NAME = level1.PORTAL_NAME
AND level1.PORTAL_NAME = LEVEL0.PORTAL_NAME;

The next one is actually better.

Friday 5 December 2014

Application Package (Public vs Protected vs Private) Methods Part 2

From my previous post, the difference between public, protected and private methods were shown by calling them outside the application class.

Today, we will try extending the base class to another application class.
The new application class will be called Australian.

This is the code for our base class, Person.

Tuesday 2 December 2014

Application Package (Public vs Protected vs Private) Methods Part 1

Today, we will check the difference between public, protected and private for Application Packages.

First, let's check this sample Application Package.

class Person
   method Person();
   method SayBarbecue();
   property string Property1;
protected
   method SayHello();
   property string Property2;
private
   method SayGoodbye();
   instance string &Property3;
end-class;

method Person
end-method;

method SayBarbecue
   MessageBox(0, "", 0, 0, "Barbecue!");
end-method;

method SayHello
   MessageBox(0, "", 0, 0, "Hello!");
end-method;

method SayGoodbye
   MessageBox(0, "", 0, 0, "Goodbye!");
end-method;

We have 3 methods.