The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

Tuesday 8 October 2013

Embedding Pivot grids in Standard Pages


People who are working in Tools 8.52 or 8.53 must be familiar with the new feature called Pivot Grids. Pivot grids provide great abilities in analytics yet maintaining the simplicity. PeopleSoft Release 9.2 is all boasted with different analytic Pivot Grids delivered by PeopleSoft. Creating a Pivot Grid is also a simple task for those who are already familiar with PS Queries. To know how to create a Pivot Grid, read my previous post on the topic.

You might find Dashboards, WorkCenters, Related Actions and Pagelets as the most suited place to put a Pivot Grid. Have you ever felt like that it will be good if I could place my Pivot Grid inside a standard page I already have? If you have the same wish I have, I have something left for you. Yes, it is possible to embed a Pivot Grid inside a standard page and it is not that difficult as you might have thought. Just follow the three simple steps.


Step I: Publish the pivot grid as a pagelet. Make sure that you check the embeddable option and note down the Pagelet ID. If you missed to note the ID, you will get it from the pagelet wizard.

Step II: Create a HTML area on your standard page and assign a work record long field (say A_WRK.HTMLAREA).

Step III: On the rowinit of the work record field’s PeopleCode event write the below PeopleCode.

/* Import the Pagelet Wizard application */
import PTPPB_PAGELET:*;


Local object &PageletID;

/* Create the Pagelet Wizard */
&PGWiz = create PTPPB_PAGELET:PageletWizard();

&PageletName = "YOUR PAGELET NAME";
&Pagelet = &PGWiz.getPageletByID(&PageletName, False);

&myHTML = &Pagelet.Execute();
A_WRK.HTMLAREA.Value = "<div class=’PSTEXT’>" | &myHTML | "</div>";



If you want to pass context sensitive prompt values to the pivot grid, then you can even do that. Try and explore the class PageletWizard for more details.

6 comments:

  1. hi this page was very useful, I was just wondering how to pass a prompt value to the Pivot grid automatically. (Which you have mentioned at the end to refer the class PageletWizard)

    Could you please help me with the following problem.
    I have a search page with the list of Emplids. When I enter the Emplid and go to Main Page it should display the data related to entered Emplid.

    Main page is having the Pagelet(Pivot Grid as the data source).

    But the entered Emplid is not passing into the Pivot Grid prompt.
    I need to click on the prompt and enter the emplid manually to get the required data.

    Can this be automated, Kindly help if anyone has come across such issue.

    Thanks in Advance.

    Best Regards,
    Sreedhar
    sreedharchalavadi@gmail.com
    +91 9916959624

    ReplyDelete
    Replies
    1. Hi Sreedhar,

      Based on your requirement it seems that you are duplicating the Pivot Grid prompt by creating a search page for entering employee id. You could directly let the user enter the employee id on the pivot grid prompt and eliminate the duplicate search page and additional logic.

      Having said that, there can be business scenarios which may force you to do so, such as displaying pivot chart along with some other component data and so on. In such cases as I have mentioned please go ahead and explore the properties available on the Pagelet and PageletWizard application classes, you will find the provision to pass the parameters there.

      To start with, You can explore more on the DataSource property within the Pagelet class and further look on the ParameterCollection and its associated methods on the DataSource.

      Once you drill into these classes you would be able to fetch the parameter and modify it. Do all these prior to calling the execute method. This may require some effort from your part to get it through.

      If you find it difficult to deal with the pagelet classes, another alternative would be to embed the Pivot Grid component as an iFrame within the html area. But that will loose the responsive behaviour of Fluid Pivot Charts. If you want to display only the Pivot Grid on the page, then instead of embedding inside a html area, redirct the user to the pivot grid url. The steps would be
      1. Generate URL for Pivot Grid Component (Menu: PTPG_WIZ_MENU Component: PTPGVIEWER).
      2. Append to the URL the Pivot Grid Name ("&PGNAME=") and View Name ("&VIEWNAME=");
      3. Append Prompt with the keyword Bind in the respective order ("&BIND1=BU1") and so on.
      4. Now redirect or display the URL generated.

      But still I recommend to use the delivered Prompt option on the pivot grid rather than doing all these. Any change in the Pivot grid rendering engine may otherwise disrupt your code.


      Thanks,
      Tony

      Delete
    2. Hi Tony,

      My apologies for the delay in response, Thank you so much for your time and explanation.

      Best regards
      Sreedhar

      Delete
  2. Hi Tony,
    Your Posts are really helpful for guys like me to learn more about PeopleSoft.
    I have a question on Pivot grid.
    Can you explain how to customize the delivered PS pivot grid drilldown ?
    Say, if we want to adjust the column width or if we need to add hyperlinks in the drill down.

    Thanks very much!

    Regards,
    Nahas

    ReplyDelete
    Replies
    1. Hi Did you get pivot grid in the html area ?
      if yes , can you please expalain, as I am getting only html in text form

      Delete
  3. it is inserting only text not the html in the html area

    ReplyDelete

Note: only a member of this blog may post a comment.

Followers