Wednesday, December 21, 2016

Number Formatting in XML Publisher

While designing XML Publisher reports, many a times we need to play with numbers and change their formats as part of the client’s requirements. Here is a brief explanation of couple of techniques that should be used while doing any number format change in XML Publisher.
XML Publisher supports two methods for specifying the number format:
  • Oracle’s format-number function
  • Microsoft Word’s Native number format mask
Now…before going into details please remember few things like:
  • To use the Oracle format mask or the Microsoft format mask, the numbers in your data source (ex XML File) must be in a raw format, with no formatting applied.
  • Use only one of these methods. If the number format mask is specified using both methods, the data will be formatted twice and it may cause unexpected behavior.
  • If you are designing a template to be translatable, using currency in the Microsoft format mask is not recommended unless you want the data reported in the same currency for all translations. Using the MS format mask sets the currency in the template so that it cannot be updated at runtime.

Using the Oracle Format Mask:

To apply the Oracle format mask to a form field:
1. Open the Form Field Options dialog box for the placeholder field.
2. Set the Type to “Regular text”.
3. In the Form Field Help Text field, enter the mask definition according to the following example:

<?format-number:fieldname;’999G999D99′?>

Where fieldname is the XML tag name of the data element you are formatting and 999G999D99 is the mask definition.
SymbolMeaning
0Digit. Each explicitly set 0 will appear, if no other number occupies the position. Format mask: 00.0000 (Ex: Change 1.234 to 01.2340)
9Digit. Returns value with the specified number of digits with a leading space if positive or a leading minus if negative. Leading zeros are blank, except for a zero value, which returns a zero for the integer part of the fixed-point number. Format mask: 99.9999 (Ex: Change 1.234 to 1.234)
CReturns the ISO currency symbol in the specified position.
DDetermines the placement of the decimal separator. The decimal separator symbol used will be determined at runtime based on template locale. Format mask: 9G999D99 (Ex: Change 1234.56 to 1,234.56( For English locale:) or to 1.234,56 (For German locale))
EEEEReturns a value in scientific notation.
GDetermines the placement of the grouping (thousands) separator. The grouping separator symbol used will be determined at runtime based on template locale. Format mask: 9G999D99 (Ex: Change 1234.56 to 1,234.56( For English locale:) or to 1.234,56 (For German locale))
LReturns the local currency symbol in the specified position.
MIDisplays negative value with a trailing “-“.
PRDisplays negative value enclosed by <>
PTDisplays negative value enclosed by ()
S (before number)Displays positive value with a leading “+” and negative values with a leading “-“
S (after number)Displays positive value with a trailing “+” and negative value with a trailing “-“

Using the Microsoft Number Format Mask:

To format numeric values, use Microsoft Word’s field formatting features available from the Text Form Field Options dialog box. The following graphic displays an example:
To apply a number format to a form field:
  1. Go into the Word Properties for the field.
  2. Change the Type drop-down box to Number (it defaults in as Regular Text)
  3. From the Number format drop-down box choose the format you want.


 


Native XSL format-number function:

You can also use the native XSL format-number function to format numbers. The native XSL format-number function takes the basic format:

format-number(number,format,[decimalformat])

Where:
number (Required) – Specifies the number to be formatted.
Format (Required)  – Specifies the format pattern. Use the following characters to specify the pattern:

SymbolMeaning
#Denotes a digit. Example: ####
0Denotes leading and following zeros. Example: 0000.00
.The position of the decimal point Example: ###.##
,The group separator for thousands. Example: ###,###.##
%Displays the number as a percentage. Example: ##%
;Pattern separator. The first pattern will be used forpositive numbers and the second for negative numbers

Decimal format (Optional) – For more information on the decimal format please consult any basic XSLT manual.

Currency Formatting:

This is another feature of XML Publisher that enables you to define specific currency format masks to apply to your published data at runtime.
To utilize currency formatting, you must:
1. Define your currency formats in XML Publisher’s Administration interface.
2. Assign the Currency Format Set as a configuration property at the desired level (site, data definition, or template).
3. Enter the format-currency command in your RTF template to apply the format to the field at runtime.
To use the format-currency command:
In the form field dialog of the field you want to format, enter the following syntax:

<?format-currency:ELEMENT_NAME;’currency-format-code’?>


For example:
<?format-currency:BALACE_TOTAL;’USD’?>

The currency code must correspond to a currency format that is defined in the Currency Format Set to be used with this report. The Currency Format Set can be specified at the site level, data definition level, or template level.






 

Friday, September 4, 2015


Some Nice to have SQL Scripts in PeopleSoft - Part III


13)      SQL Query to find out the records exposed by a Component Interface

SELECT distinct RECNAME
FROM PSBCITEM
WHERE BCNAME = 'XXXX_CI';
 
14)       SQL Query to find search records in a Component Interface
SELECT SEARCHRECNAME, ADDSRCHRECNAME
FROM PSBCDEFN
WHERE BCNAME = 'XXXX_CI';
 
15)       SQL to find All Records under a specified component
SELECT DISTINCT RECNAME FROM PSRECDEFN
WHERE ( RECNAME IN (SELECT RECNAME FROM PSPNLFIELD WHERE PNLNAME IN (SELECT DISTINCT B.PNLNAME
FROM PSPNLGROUP A, PSPNLFIELD B WHERE (A.PNLNAME = B.PNLNAME OR A.PNLNAME = B.SUBPNLNAME)
AND A.PNLGRPNAME = 'JOB_DATA'))
OR RECNAME IN (SELECT RECNAME FROM PSPNLFIELD WHERE PNLNAME IN (SELECT DISTINCT B.SUBPNLNAME
FROM PSPNLGROUP A, PSPNLFIELD B WHERE (A.PNLNAME = B.PNLNAME OR A.PNLNAME = B.SUBPNLNAME)
AND A.PNLGRPNAME = 'JOB_DATA'))
 
16)       SQL to find the Navigation of a PeopleSoft Process
       SQL to find the navigation to the run control page by Process Name in PeopleSoft.
SELECT E.PRCSTYPE, E.PRCSNAME, F.DESCR, DECODE( H.PORTAL_LABEL,' ','','','','Root','Root ','Root > ' || H.PORTAL_LABEL) || '> ' || G.PORTAL_LABEL || ' > ' || C.PORTAL_LABEL || ' > ' || B.PORTAL_LABEL || ' > ' || A.PORTAL_LABEL || ' > ' || D.PORTAL_LABEL , D.DESCR254, E.PNLGRPNAME,D.PORTAL_NAME,D.PORTAL_REFTYPE,D.PORTAL_OBJNAME,F.PRCSTYPE,F.PRCSNAME
FROM PSPRSMDEFN D, PS_PRCSDEFNPNL E, PS_PRCSDEFN F, PSPRSMDEFN A, PSPRSMDEFN B, PSPRSMDEFN C, PSPRSMDEFN G, PSPRSMDEFN H
WHERE E.PNLGRPNAME = D.PORTAL_URI_SEG2
AND E.PRCSTYPE = F.PRCSTYPE
AND E.PRCSNAME = F.PRCSNAME
AND D.PORTAL_NAME = 'EMPLOYEE'
AND D.PORTAL_REFTYPE = 'C'
AND E.PNLGRPNAME > ' '
AND A.PORTAL_NAME = 'EMPLOYEE'
AND A.PORTAL_OBJNAME = D.PORTAL_PRNTOBJNAME
AND B.PORTAL_NAME = 'EMPLOYEE'
AND B.PORTAL_OBJNAME = A.PORTAL_PRNTOBJNAME
AND C.PORTAL_NAME (+) = 'EMPLOYEE'
AND C.PORTAL_OBJNAME(+) = B.PORTAL_PRNTOBJNAME
AND G.PORTAL_NAME(+) = 'EMPLOYEE'
AND G.PORTAL_OBJNAME(+) = C.PORTAL_PRNTOBJNAME
AND H.PORTAL_NAME(+) = 'EMPLOYEE'
AND H.PORTAL_OBJNAME(+) = G.PORTAL_PRNTOBJNAME
AND E.PRCSNAME ='Process Name'
ORDER BY 1, 2, 4


Some Nice to have SQL Scripts in PeopleSoft - Part II


6)      SQL to get the roles assigned to a permission list

SELECT B.ROLENAME, B.CLASSID AS PERMISSION_LIST
FROM PSCLASSDEFN A, PSROLECLASS B
WHERE A.CLASSID = B.CLASSID AND A.CLASSID = 'PTPT1200'
ORDER BY 1,2;



7)      SQL to identify which user, role and permission-list access to a particular component interface
SELECT DISTINCT R.ROLEUSER AS USER_IDS, C.ROLENAME as ROLE, P.CLASSID AS PERMISSION_LIST
FROM PSROLEUSER R, PSROLECLASS C, PSAUTHBUSCOMP P
WHERE R.ROLENAME = C.ROLENAME
AND P.CLASSID = C.CLASSID
AND P.BCNAME = 'JOB_DATA_CI'
ORDER BY 1,2,3;
8)      SQL to get the list of query security trees that an oprid has access
SELECT distinct P.TREE_NAME,P.ACCESS_GROUP,P.ACCESSIBLE
FROM PS_SCRTY_ACC_GRP P, PSROLECLASS C, PSROLEUSER R
WHERE R.ROLENAME = C.ROLENAME
AND P.CLASSID = C.CLASSID
AND R.ROLEUSER = 'User ID'
AND P.ACCESSIBLE = 'Y'
ORDER BY 1,2;
9)      SQL to get the Process Scheduler Server status
SELECT S.SERVERNAME, X.XLATSHORTNAME,X.FIELDVALUE,S.MAXCPU,S.PRCSDISKSPACE,S.LASTUPDDTTM
FROM PSSERVERSTAT S, PSXLATITEM X
WHERE X.FIELDNAME = 'SERVERSTATUS' AND X.FIELDVALUE = S.SERVERSTATUS;
 
10)       SQL query to get all the child records for a parent record:
SELECT RECNAME FROM PSRECDEFN
CONNECT BY PRIOR RECNAME=PARENTRECNAME
START WITH PARENTRECNAME = 'PS_JOB';
 
 
11)       SQL to identify which USER, ROLE and PERMISSION LIST has access to a particular Component Interface
SELECT DISTINCT R.ROLEUSER AS USER_IDS, C.ROLENAME as ROLE, P.CLASSID    
AS PERMISSION_LIST
FROM PSROLEUSER R, PSROLECLASS C, PSAUTHBUSCOMP P
WHERE R.ROLENAME = C.ROLENAME
AND P.CLASSID = C.CLASSID
AND P.BCNAME = 'XXXX_CI'
ORDER BY 1,2,3;
 
12)       SQL Query to find out the Component associated with a Component Interface
SELECT BCPGNAME,MARKET,MENUNAME
FROM PSBCDEFN
WHERE BCNAME = 'XXXX_CI';

 




 

Some Nice to have SQL Scripts in PeopleSoft - Part I
1)      SQL Query to identify the record's of a component
SELECT DISTINCT D.recname TableName,
D.occurslevel ScrollName
FROM pspnlgrpdefn A,
pspnlgroup B,
pspnldefn C,
pspnlfield D,
psrecdefn E
WHERE A.pnlgrpname = B.pnlgrpname
AND A.market = B.market
AND B.pnlname = C.pnlname
AND C.pnlname = D.pnlname
AND A.pnlgrpname = 'JOB_DATA'
AND E.recname = D.recname
AND E.rectype IN ( 0 )
AND To_char(Bitand(D.fielduse, 16)) <> '16'
ORDER BY 2,1
2)      SQL to find the navigation to a Component
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 = 'JOB_DATA'
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


3)      SQL to get the list of users connected to the environment in last 30 days, with connections count
 
SELECT TO_CHAR(A.LOGINDTTM,'YYYY-MM-DD'),A.OPRID, sum(1) "Connections"
FROM PSACCESSLOG A
WHERE TO_CHAR(A.LOGINDTTM,'YYYY-MM-DD') >= TO_CHAR(SYSDATE - 30,'YYYY-MM-DD')
GROUP BY TO_CHAR(A.LOGINDTTM,'YYYY-MM-DD'),A.OPRID
ORDER BY TO_CHAR(A.LOGINDTTM,'YYYY-MM-DD') DESC, A.OPRID;
 
4)      SQL to get the Number of users connected to the environment in last 30 days
SELECT TO_CHAR(A.LOGINDTTM,'YYYY-MM-DD'),count(distinct A.OPRID) "Users"
FROM PSACCESSLOG A
WHERE TO_CHAR(A.LOGINDTTM,'YYYY-MM-DD') >= TO_CHAR(SYSDATE - 30,'YYYY-MM-DD')
GROUP BY TO_CHAR(A.LOGINDTTM,'YYYY-MM-DD')
ORDER BY TO_CHAR(A.LOGINDTTM,'YYYY-MM-DD') DESC;
5)      SQL to get the Role's and user id's assigned to a permission list
 
SELECT C.ROLEUSER AS USER_IDS, B.ROLENAME as ROLE
FROM PSCLASSDEFN A, PSROLECLASS B, PSROLEUSER C
WHERE A.CLASSID = B.CLASSID AND B.ROLENAME = C.ROLENAME AND A.CLASSID = 'PTPT1200'
ORDER BY 1,2;

Diffrence between SETID and Business Unit

Business Units

Business Units are logical units created within any organization for
reporting purposes and don't have any predetermined restrictions or
requirements. This flexible structuring device enables you to actually
define a higher level of reporting for your employees and group them
according to functional or administrative tasks or for your business
purposes.

One can define Business Units that reflect the specific functional
needs of your internal human resources departments, or reflect the actual
business structure of your enterprise. Your Business Units may be, for
example, companies, agencies, subsidiaries, divisions, departments, or
branch offices within your organization. Or, you may choose to have a
single Business Unit represent your entire organization. It's up to you and
your unique business needs.

TableSets and SetIDs

Once you've established Business Units, you can define TableSets, or
groups of tables, for your system-wide control tables, so that you can share
the
same code values among multiple Business Units within your enterprise.
Conversely, the TableSet feature also enables you to limit access to
specific data to only those users who need it, while maintaining all of
your data on the same tables. The flexibility to share TableSets among
Business
Units enables you to centralize redundant information while you keep other
information, such as Department and Job Codes, decentralized. You can use
Business Units and TableSets to associate a Business Unit with employees
in your enterprise and to specify how default values for currencies and
country codes will behave throughout the HRMS system, based on either the
user's
Permission List or the Business Unit that the system is referencing during
a particular business process or activity.

Where a Business Unit organizes your company or your organization, SetIDs
help you organize your data within the system. The HRMS system uses tables
(Control Tables or Prompt Tables) that use a high-level key that enables
you to identify and retrieve data from the system. A secondary high-level
key,referred to as a SetID, has also been added on various tables. SetIDs are
simply the labels used to identify a TableSet. Business Unit and SetID
functionality in PeopleSoft also provides you with a higher business
level for reporting purposes and other business data roll-up.

Some more points to Note :

=> All the transaction tables should store the business
unit as a First level Key, so that reports based on business units can
be generated.

=> All the control tables and prompt tables should store setid as the
first level key to share the data
 

Wednesday, December 10, 2014

You Don’t Have to Write PeopleCode to Create an XML / BI Publisher Report using PS Query - Part 4


Define the Report Definition


A Report Definition is where we tie the data source and the template files together. To define a Report Definition, navigate to Reporting Tools > BI Publisher > Report Definition and clink on Add New Value.

PS: A data source is automatically registered for you if you choose to use a Query or Connected Query data source that has not yet been registered. This would save you some time!

Provide a name for the report – HA_US001
Select PS Query from the Data Source Type list.
Select Data Source Id as HA_DEMO_XML that we created earlier.


These are the details we entered in the Definition page.



Note that the Report Status is Pending to begin with. After we are done with all the pages in this component, will we come back to this field and make it Active.
On the Output page, we just keep the pdf format enabled. You may want to keep other formats if that suits your requirement.

On the Security page, we add the PeopleSoft User role so that everyone with this role would be able to see the output of this report posted to the Report Manager.

Uploading and previewing an XMLP Template

The Template page allows you to have multiple templates and multiple template files per template. In our example, we just have one template and one template file (.rtf).



You Don’t Have to Write PeopleCode to Create an XML / BI Publisher Report using PS Query - Part 3


Create the Template

Now we will create a simple template using XML / BI Publisher design helper for MS Word.

Load XML Data

Before we start using the design helper, we need to have our sample xml data loaded into the tool. To do this, open Word and load the xml data file from the previous step as shown below.




Inport the XML/XSD File
Upon successfully loading the data, a message, like the one below, is shown.

Table Wizard

Now we will use the table wizard to insert a simple table into the template. The data that gets pulled from the query would finally be shown in this table.


Select Table and click Next.

Since we have only one repeating element (query/row), no selection needs to be done here. Click Next and continue.

Here we select the fields we want to display in our table. Use the button (>) to select the required ones and then click Finish.

In fact, if you keep pressing the Next button, you would be shown screens on which you can perform grouping of data and then sorting the data. We are not covering them here.
Now we will add some text to the template. How about a headline that says US001 Vouchers? You can insert logos or do any formatting supported by Word.
This is how our final template looks.

Preview the Template

Before we can preview the template, it should be saved as an RTF file. If you don’t do this, the system would prompt you to save once you click the preview menu.
So let’s save the file as Ha_us001.rtf
Now go to the Preview menu and click on PDF.

A pop-up window with the PDF file containing sample data opens.

If you are not happy with the preview, keep making changes.
Once done, save the template file and we are ready for the next step.

You Don’t Have to Write PeopleCode to Create an XML / BI Publisher Report using PS Query -Part 2


This is the second post in the XMLP tutorial series and will help you create your first simple XML Publisher report using Query as the data source.

Let’s get started.

Create a Data Source (Query)

As you saw in the getting started post, XML Publisher clearly separates the data extraction logic from data presentation. Data extraction is handled by the Data Source. In this tutorial, we will be using a PS Query as the data source – the source of data for our report.
Apart from PS Queries, XML Publisher also supports Connected Queries and XML files as data sources. We will see Connected Queries and XML files in future posts.
Now, we will quickly look at VOUCHERS of US001, a query I’d already created. It fetches few fields from the VOUCHER table. To keep things simple, I’ve specified a criteria to limit the Business Unit to US001 so that only Vouchers belonging to this BU get fetched. The SQL underlying the query is given below.


On running this query, you get the below output.









You can create your own query by navigating to Reporting Tools > Query > Query Manager and then clicking the Create New Query link. The query you create would be your data source.
Now that our query is ready, let’s go ahead and register it.

Register the Data Source

To register a data source, navigate to Reporting Tools > BI Publisher > Data Source and clink on Add New Value.

As mentioned earlier, PeopleSoft presently offers support for three data source types – Connected Query, PS Query and XML File. From this list of three, we will choose PS Query.
PS: Data source types Rowset and XMLDoc were deprecated in PeopleTools 8.50 . So you will not be able to add these data source types in newer versions. However, you can still view and edit the existing ones.
Data Source ID is the name of the query we created in the previous step – HA_DEMO_XML

Download the sample XML data file onto your desktop and save it HA_DEMO_XML.XML. In the next step, we will use this file for building our template using MS Word.