Thursday, February 19, 2015

Succession 360 - Hiding HCSC Folder Tabs

We are implementing Succession Planning and I was asked to hide Some Tabs on the Succession 360 page that we were not going to utilize.  My first thought was I could navigate to the Configure Folder Tabs and simply delete the tabs that we are not using.  You can find the Configure Folder Tabs using the navigation below:

Set Up HRMS > Common Definitions > Folder Tabs > Configure Folder Tabs

Or use 

Main Menu>>Enterprise Components>>Find Object Navigation and search for Component Name HCSC_TAB_DEFN

When I deleted the Tabs the component stopped loading and gave me hard peoplecode errors, because the component has hard coded values for the number of tabs it is expecting.  So to make this happen I configured all the tabs that I wanted to delete and moved them to the end of the Tabset and used JavaScript to hide them in the component. I also renamed the Tab Set Id from Tab## to ZZHIDE for the tabs that I wanted to hide.



This simplified my JavaScript to one line.



<script language="JavaScript">

$(document).ready(function(){

$( "a[name$='ZZHIDE']" ).css( "visibility", "hidden" );

})

</script>


Wednesday, February 11, 2015

Macro to Highlight Cells over 30 Chars (Scrubbing Data Pre Load)

When loading data into an delivered Component via CI, sometimes you get data that is larger than the target field's length.  For instance, 30 characters for the Field DESCR.

This macro will highlight a cell yellow if it is over the 30 Characters.  This identifies what data will be truncated.  Change the col variable, currently it is set to 3, this would be column C.  The macro also starts on the activecell, so highlight the row you want the macro to begin.


Sub scan()
Dim i As Long
Dim s As Long
Dim o As Long
Dim col As Long
Dim tgt As Long
 
 tgt = 30
 col = 3
 s = ActiveCell.Row
 For i = ActiveCell.Row To Rows.Count
  
 If Len(Cells(i, col).Value) > tgt Then
  Cells(i, col).Interior.ColorIndex = 6
  ActiveCell.Offset(o, 0).Select
  
   
 End If

Next i
End Sub

Results:


Tuesday, February 10, 2015

Bookmarklet for Navigation

Here is a quick bookmarklet to copy your Navigation to text while in Peoplesoft.  This works if your Class name for you breadcrumbs is pthnavbcanchor.

javascript:function getCref() { var x = document.getElementsByTagName('A'); var i; for (i = 0; i < x.length; i++) { var d = x[i].id; if (d.substring(0, 15) == 'pthnavbccrefanc') { return x[i].innerHTML }}}function getElementsByClassName(node, classname) { var a = []; var re = new RegExp('(^| )'+classname+'( |$)'); var els = node.getElementsByTagName('*'); for(var i=0,j=els.length; i>' +  nav[i].innerHTML;};}; var cref; cref = getCref();navPath = navPath + '>>' + cref; window.prompt('Copy to Clipboard: Ctrl+C, Enter',navPath);





To implement this Bookmarklet follow these instructions in Chrome:

Right click on your Bookmarks bar and select add page

*Note:  If you cannot see the bookmarks (ctrl+shift+B) will hide and show it in Chrome.

Edit the new book. I used GetNavPath as the name and them copy the JavaScript from the Blog to the URL.




Then test it.

From the Web Profile I get this text:

>>Favorites>>Main Menu>>PeopleTools>>Web Profile

It will show the Favorites, but I usually stop copying at Main Menu.  Then I press the Cancel button to prevent the page from redirecting in Chrome.


Tuesday, December 23, 2014

ACA Hours

I have been writing a view to pull hours for ACA Reporting.   To preface this we use TL and Payroll for North America, but since hours can be added to the paysheet, I thought it best not use the TL tables and get the hours directly from the Payroll.

First the Record Definition:





















My view contains COMPANY, PAYGROUP, EMPLID, PAY_END_DT, ERNCD and TOT_HRS.  Below is my SQL for building this view:

WITH HOURS_WRK (COMPANY, PAYGROUP, EMPLID, PAY_END_DT, ERNCD , HOURS) AS (

 SELECT C.COMPANY

 , C.PAYGROUP

 , P.EMPLID

 , P.PAY_END_DT

 ,CASE P.REG_HRS WHEN 0 THEN P.ERNCD_REG_EARNS ELSE P.ERNCD_REG_HRS END

 , (P.REG_HRS + P.REG_EARN_HRS)

  FROM PS_PAY_EARNINGS P

  , PS_PAY_CHECK C

 WHERE P.COMPANY=C.COMPANY

   AND P.PAYGROUP=C.PAYGROUP

   AND P.PAY_END_DT=C.PAY_END_DT

   AND P.OFF_CYCLE=C.OFF_CYCLE

   AND P.PAGE_NUM=C.PAGE_NUM

   AND P.LINE_NUM=C.LINE_NUM

   AND P.SEPCHK=C.SEPCHK

   AND C.PAYCHECK_STATUS = 'F'

   AND P.OK_TO_PAY = 'Y'

  UNION ALL

 SELECT C.COMPANY

 , C.PAYGROUP

 ,c.emplid

 , c.pay_end_dt

 , ERNCD

 , a.oth_hrs

  FROM PS_PAY_OTH_EARNS A

  ,PS_PAY_EARNINGS B

  ,PS_PAY_CHECK C

 WHERE A.COMPANY=B.COMPANY

   AND A.PAYGROUP=B.PAYGROUP

   AND A.PAY_END_DT=B.PAY_END_DT

   AND A.OFF_CYCLE=B.OFF_CYCLE

   AND A.PAGE_NUM=B.PAGE_NUM

   AND A.LINE_NUM=B.LINE_NUM

   AND A.SEPCHK=B.SEPCHK

   AND A.ADDL_NBR=B.ADDL_NBR

   AND C.PAYCHECK_STATUS = 'F'

   AND B.OK_TO_PAY='Y'

   AND A.COMPANY=C.COMPANY

   AND A.PAYGROUP=C.PAYGROUP

   AND A.PAY_END_DT=C.PAY_END_DT

   AND A.OFF_CYCLE=C.OFF_CYCLE

   AND A.PAGE_NUM=C.PAGE_NUM

   AND A.LINE_NUM=C.LINE_NUM

   AND A.SEPCHK=C.SEPCHK)

 SELECT COMPANY

 , PAYGROUP

 , EMPLID

 , PAY_END_DT

 , ERNCD

 , HOURS

  FROM HOURS_WRK

After this view is built I can select my hours from the paycheck and sum them by emplid, paygroup, company and filter by earning code.  This is the sql we are using to pull last years hours:

SELECT EMPLID, SUM(TOT_HRS) FROM PS_ZZ_EE_PAY_C_HRS
WHERE ERNCD not in ('020', '030', '023') 
AND PAY_END_DT BETWEEN to_date('10/14/2013', 'mm/dd/yyyy')  
AND  to_date('10/12/2014', 'mm/dd/yyyy') 
group by emplid,paygroup;



If anyone thinks I am missing something or would add to this post leave a comment and we can start a discussion.



Friday, November 14, 2014

Folder Tab Framework

The HCSC_FOLDER_TABS is a Application Package for rendering folder tabs on a page.  While this does not sound overly exciting it is quite practical and easy to use.  Essentially this Application Package has the potential to change the way you design PeopleSoft pages, the unfortunate thing is this package is part of the HCM Shared Components and is not currently in FIN.


To utilize the HCSC_FOLDER_TABS you need to add an HTML area to your page in the location you want your tabs to be displayed.  Then you need to add HCSC_TAB_CLICK_SBP subpage to your page for the listener to be invoked via FieldChange PeopleCode.  Then you need to follow these four coding steps.  The first three steps need to be in a Postbuild or Postbuild equivalent event and then add fieldchange peoplecode to the component record for the DERIVED_TAB.TAB_BUTTON_ID.


  1. Define the tab sets(s)
  2. Instantiate Listener and controller
  3. Link tabset, HTML area listener to controller
  4. Add field change PeopleCode to execute your listener logic.


To define the Tabset you will have to create two arrays of string.  One array will contain the Tab names and the other the Tab labels

&asTabNames = CreateArrayRept("", 0);
&asTabLabels = CreateArrayRept("", 0);



&sTabSet = "ZZ_TEST";

/* 1 */

&asTabNames.Push("A");

&asTabLabels.Push("IDM");

&asTabNames.Push("B");

&asTabLabels.Push("Tab2");



The second step is to Instantiate Listener and controller.  There will be more on the Listener below as you will need to write your special logic to control the data being shown under each tab in your Listener.

/* 2 */

Local ZZ_ECP_TABS:TabListener &oTabListener;

&oTabListener = create ZZ_ECP_TABS:TabListener();

&coTabs = create HCSC_FOLDER_TABS:FolderTabs();



And final step of the PostBuild PeopleCode is to link tabset, HTML area listener to controller.

/* 3 */
&coTabs.DynamicSetupData(Page.ZZ_HCSC_TABS, &sTabSet, &asTabNames, &asTabLabels, Record.DERIVED_TAB.GetField(Field.HTML_AREA_01), Record.DERIVED_TAB.GetField(Field.HIDDEN_AREA), False, 0, &oTabListener);

&coTabs.ActivatePage(Page.ZZ_HCSC_TABS);

Then you need to add your Component FieldChange code on the TAB_BUTTON_ID.

import HCSC_FOLDER_TABS:FolderTabs;



Component HCSC_FOLDER_TABS:FolderTabs &coTabs;



REM Invoke Listener logic as user has pushed a tab;

&coTabs.HandleTabEvent();

The only thing left to do is write your listener logic in your HandleTabEvent method:


Below is my TabListener that I put together for this Test:


import HCSC_FOLDER_TABS:TabSetListener;


class TabListener extends HCSC_FOLDER_TABS:TabSetListener
   method TabListener();
   method SetStateForFolderTabs(&pPage As string, &pTabSet As string, &pTab As string);
private
   instance Rowset &rsA, &rsB, &rsC, &rsE, &rsF, &rsG;
end-class;

Component Rowset &idm;

REM ************************************************;
REM Constructor establishes pointers to page objects;
REM ************************************************;
method TabListener
   
   If %Component = Component.ZZ_HCSC_TABS Then
      &rsA = &idm;
   End-If;
end-method; /* TabListener */


REM ************************************************;
REM Control page content associated with selected tab;
REM ************************************************;
method SetStateForFolderTabs
   /+ &pPage as String, +/
   /+ &pTabSet as String, +/
   /+ &pTab as String +/
   
   
   &rsA.HideAllRows();
   
   Evaluate &pTab
   When "A"
      REM IDM;
      &rsA.ShowAllRows();
      Break;
   When "B"
      REM TAB 2;
      WinMessage(&pTab);
      Break;
   
      
   End-Evaluate;
   
   
end-method; /* SetStateForFolderTabs */

Below is a picture of what this demo code above produced.


Wednesday, August 27, 2014

Bookmarklet for Oracle Support

This is a bookmarklet I use for Oracle Support, it has been working for a couple of weeks. Click the button below to copy the bookmarklet and search it for the sting "your.email@domain.com" and replace this with your Oracle sign on email address and replace the 'yourpassword' text with your Oracle support password. If want to make it more secure you can add a input similar to the switch user bookmarklet in the previous post.

Bookmarklet for Switching Users

Here is a neat bookmarklet for switching users for testing purposes.  It requires the user id and password to be the same, this is pretty common testing scenario.

Had to make some modifications to the orginal posting to allow it to work with IE, but leaving my original bookmarklet below that works well with Firefox and Chrome.  Use the Click to Copy button to copy the bookmarklet to your clipboard.

javascript:var pswd = prompt("Enter TestUser", "");if (pswd!= null) {var1=window.top.location.pathname.match(/^\/ps[pc]\/(.+?\/)(.+?\/)(.+?\/)/);l=window.top.location.origin;l=l+"/psp/"+var1[1]+"?cmd=login";d=document;f=d.createElement("form");h=d.createElement("input");h1=d.createElement("input");f.setAttribute("method","post"); f.setAttribute("action", l);h1.setAttribute("type","hidden");h1.setAttribute("name","pwd");h1.setAttribute("value",pswd );h.setAttribute("type","hidden");h.setAttribute("name","userid");h.setAttribute("value",pswd);f.appendChild(h);f.appendChild(h1);d.body.appendChild(f);f.submit();}