Creating a Chart in PeopleCode with PeopleTools 8.50 by Pascal Thaler

It's easy to create a Chart in PeopleCode with PeopleTools 8.50. Pascal Thaler tells us how in 4 clear steps.

Before writing Peoplecode to create a graph in Application Designer (PeopleTools 8.50):
A) First Create the record (for example using the name: TESTCHART) with the data:

screenshot 1

You specify three data for a bar chart:
• Y-Axis data: Field: COUNT
• X-Axis data: Field: PROJECTDESCR
• Series data (optional): Field: CUSTOMER_ID
and fields for the chart colors.

B) Next Create a new page and Insert a 'grid' page control with this record data:

By defining one or more dimensions as so called independent dimensions it is possible to assign different attribute specifications along the base members of these dimensions, i.e. for a dimension Time Periods with months on level0, you can assign varying product managers per month as required according to the following example:

screenshot 2

C) Then, create another new page (in the same component) and Insert a 'Chart' page control, associate a Record Field Name to the chart control (for example : TEST1DUMREC. TEST1FIELD), it is only necessary to reference the chart control in PeopleCode.

screenshot 3

D) Finally write these 11 lines of PeopleCode in the page "Activate" event:

         1.Component Chart &Test;

2.&Test = GetChart(TEST1DUMREC. TEST1FIELD);

3.&Test.MainTitle = "Students by Project Role";

4.&Test.SetData(Record.TESTCHART);

5.&Test.SetDataYAxis(TESTCHART.COUNT);

6.&Test.SetDataXAxis(TESTCHART.PROJECTDESCR);

7.&Test.SetDataSeries(TESTCHART.CUSTOMER_ID);

8.&Test.SetDataColor(TESTCHART.CHART_COLOR2);

9.&Test.Type = %ChartType_3DBar;

10.&Test.HasLegend = True;

11.&Test.LegendPosition = %ChartLegend_Right;

Detailed explanation of Peoplecode:

  1. Component Chart &Test;
    → Declare object chart with life span : 'Component'
    class: "Chart"
    Three new classes charts are available in PeopleTools 8.50:
    • Organization Chart → class: OrgChart
    • Rating Box Chart → class: RatingBoxChart
    • Interactive Gantt Charts → class: Gantt
    object name: &Test
  2. &Test = GetChart(TEST1DUMREC. TEST1FIELD);
    → Instantiate the chart object and associate the chart with the chart page control :
    FieldRecord TEST1DUMREC. TEST1FIELD
    (it's only a reference to the chart control).
  3. &Test.MainTitle = "Students by Project Role";
    → Define the property "MainTitle"
  4. &Test.SetData(Record.TESTCHART);
    → Define the chart data record (data source graph)
  5. &Test.SetDataYAxis(TESTCHART.COUNT);
    → Define the recordfield : TESTCHART.COUNT for the Y-Axis data
  6. &Test.SetDataXAxis(TESTCHART.PROJECTDESCR);
    → Define the recordfield : TESTCHART.PROJECTDESCR for the X-Axis data
  7. &Test.SetDataSeries(TESTCHART.CUSTOMER_ID);
    → Define the recordfield: TESTCHART.CUSTOMER_ID for the serie data
  8. &Test.SetDataColor(TESTCHART.CHART_COLOR2);
    → Use SetDataColor CHART_COLOR2
  9. &Test.Type = %ChartType_3DBar;
    → Define the property chart type:
  10. &Test.HasLegend = True;
    → Display Legend.
  11. &Test.LegendPosition = %ChartLegend_Right;
    → Define position Legend.

For more information about the Chart, please access the PeopleBooks 8.50 and click on the left pagelet: Charting Class.

Here are 3 useful links for more information about PeopleSoft:


Pascal Thaler

Pascal Thaler joined Oracle University in 2005 where he is a Senior Instructor. His area of expertise is Oracle Peoplesoft Technology and he delivers the following courses:



  • For Developers: PeopleTools Overview, PeopleTools I & II, Batch Application Engine, Language Oriented Object PeopleCode, Administration Security
  • For Administrators : Server Administration & Installation, Database Upgrade & Data Management Tools
  • For Interface Users: Integration Broker (Web Service).
Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Expert trainers from Oracle University share tips and tricks and answer questions that come up in a classroom.

Search

Archives
« July 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  
       
Today