Reporting – Sort Orders, Selections, and Related Data TEC02 Brian Ciccolo.

Slides:



Advertisements
Similar presentations
PHP functions What are Functions? A function structure:
Advertisements

RightNow 8 -- Adding a new report: New > Report: ORAnalytics > Reports > New Report
Chapter 6 Type Checking. The compiler should report an error if an operator is applied to an incompatible operand. Type checking can be performed without.
Programmer-defined classes Part 2. Topics Returning objects from methods The this keyword Overloading methods Class methods Packaging classes Javadoc.
Introduction to C# Erick Pranata © Sekolah Tinggi Teknik Surabaya 1.
CSCI 1100/1202 April 3, Testing A program should be executed multiple times with various input in an attempt to find errors Debugging is the process.
George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
Mark Dixon Page 1 02 – Queries: Query by Example.
CS102--Object Oriented Programming Review 1: Chapter 1 – Chapter 7 Copyright © 2008 Xiaoyan Li.
Applying OO Concepts Using Java. In this class, we will cover: Overriding a method Overloading a method Constructors Mutator and accessor methods The.
CS 1110 Final Exam: Review Session 2 Part 1 : Inheriting classes 1. Inheritance Facts 2. Constructors in Subclasses BREAK : 10 sec. Part 2 : Working with.
® IBM Software Group © 2006 IBM Corporation How to read/write XML using EGL This Learning Module shows how to utilize an EGL Library to read/write an XML.
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
Principles of Computer Programming (using Java) Review Haidong Xue Summer 2011, at GSU.
UML Basics & Access Modifier
CMSC 202 Interfaces. 11/20102 Classes and Methods When a class defines its methods as public, it describes how the class user interacts with the method.
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
1 v1.6 08/02/2006 Overview of Eclipse Lectures 1.Overview 2.Installing and Running 3.Building and Running Java Classes 4.Refactoring 5.Debugging 6.Testing.
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
Introduction to Programming David Goldschmidt, Ph.D. Computer Science The College of Saint Rose Java Fundamentals (Comments, Variables, etc.)
The Java Programming Language
Introduction to Eclipse CSC 216 Lecture 3 Ed Gehringer Using (with permission) slides developed by— Dwight Deugo Nesa Matic
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
An Object-Oriented Approach to Programming Logic and Design Chapter 3 Using Methods and Parameters.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Adding Parameters to Commands ADO.NET - Lesson 06  Training time: 15 minutes.
1 CSC/ECE 517 Fall 2010 Lec. 3 Overview of Eclipse Lectures Lecture 2 “Lecture 0” Lecture 3 1.Overview 2.Installing and Running 3.Building and Running.
Chapter 6. else-if & switch Copyright © 2012 Pearson Education, Inc.
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 5 Creating Classes.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 26 - Java Object-Based Programming Outline 26.1Introduction.
Introduction to Java Chapter 7 - Classes & Object-oriented Programming1 Chapter 7 Classes and Object-Oriented Programming.
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 7 1 Microsoft Office FrontPage 2003 Tutorial 8 – Integrating a Database with a FrontPage.
 In the java programming language, a keyword is one of 50 reserved words which have a predefined meaning in the language; because of this,
S11-1 ADM , Section 11, August 2005 Copyright  2005 MSC.Software Corporation SECTION 11 MACROS: OVERVIEW.
N. HARIKA Lecturer(csc). 3 General Structure Of A Java Program.
Interfaces and Inner Classes
By Mr. Muhammad Pervez Akhtar
Package A package is a logical container that contains classes,interfaces sub packages. Package provide a unique name space to its members and provide.
Chapter 11: Advanced Inheritance Concepts. Objectives Create and use abstract classes Use dynamic method binding Create arrays of subclass objects Use.
Topic 8Classes, Objects and Methods 1 Topic 8 l Class and Method Definitions l Information Hiding and Encapsulation l Objects and Reference Classes, Objects,
Quick Review of OOP Constructs Classes:  Data types for structured data and behavior  fields and methods Objects:  Variables whose data type is a class.
In this class, we will cover: Overriding a method Overloading a method Constructors Mutator and accessor methods The import statement and using prewritten.
© 2006 Pearson Addison-Wesley. All rights reserved 1-1 Chapter 1 Review of Java Fundamentals.
Execution ways of program References: www. en.wikipedia.org/wiki/Integrated_development_environment  You can execute or run a simple java program with.
Creating Java Applications (Software Development Life Cycle) 1. specify the problem requirements - clarify 2. analyze the problem - Input? Processes? Output.
© 2011 Pearson Education, publishing as Addison-Wesley Chapter 1: Computer Systems Presentation slides for Java Software Solutions for AP* Computer Science.
JAVA ACCESS MODIFIERS. Access Modifiers Access modifiers control which classes may use a feature. A classes features are: - The class itself - Its member.
Java Programming: Guided Learning with Early Objects Chapter 9 Inheritance and Polymorphism.
Definition of the Programming Language CPRL
More Sophisticated Behavior
Chapter 7 User-Defined Methods.
Module Road Map Refactoring Why Refactoring? Examples
Data Virtualization Tutorial: Introduction to SQL Script
Databases – exercises in Microsoft Access 2013
Inheritance and Polymorphism
More About Objects and Methods
Mobile Application Development Chapter 5 [Persistent Data in Android]
Chapter 3: Using Methods, Classes, and Objects
Starting JavaProgramming
Overview of Eclipse Lectures
CMSC 202 Interfaces.
Java Programming Language
User-Defined Classes and ADTs
Chap 1 Chap 2 Chap 3 Chap 5 Surprise Me
Applying OO Concepts Using Java
Programs and Classes A program is made up from classes
Tonga Institute of Higher Education
Session 2: Introduction to Object Oriented Programming
CMSC 202 Interfaces.
Navigation to Smart List Builder
Presentation transcript:

Reporting – Sort Orders, Selections, and Related Data TEC02 Brian Ciccolo

Agenda Navigating the report Java source Determining a report’s “root table” Adding sort order options Adding selection options Adding related data lookup maps

Navigating the Report Java Source Before you can customize the Java, you must first understand the Java. Before you can understand the Java, you must first understand its components. ~ Ancient X2 Proverb

Copyright Comment /* * ==================================================================== * * X2 Development Corporation * * Copyright (c) X2 Development Corporation. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, is not permitted without a written agreement * from X2 Development Corporation. * * ==================================================================== */

Package and Imports package com.x2dev.sis.reports.system; import net.sf.jasperreports.engine.JRDataSource; import org.apache.ojb.broker.query.*; import com.x2dev.sis.model.beans.*; import com.x2dev.sis.model.business.*; import com.x2dev.sis.tools.reports.*; import com.x2dev.sis.web.UserDataContainer;

Class Comment /** * Prepares the data for the Student Profile report. This report simple selects * students from the current school (with an optional criteria for YOG or homeroom) * and order the results by YOG, homeroom, or last name. * X2 Development Corporation */

Class Definition public class StudentProfileData extends ReportJavaSourceNet { // Bunch of stuff... }

Constants /** * Name for the "active only" report parameter. The value is an Boolean. */ public static final String ACTIVE_ONLY_PARAM = "activeOnly"; /** * Name for the enumerated "selection" report parameter. The value is an Integer. */ public static final String QUERY_BY_PARAM = "queryBy"; /** * Name for the "selection value" report parameter. The value is a String. */ public static final String QUERY_STRING_PARAM = "queryString"; /** * Name for the "secondary students" report parameter. The value is a Boolean. */ public static final String SECONDARY_STUDENT_PARAM = "secondaryStudent";

Member Variables private Student m_currentStudent;

gatherData() /** com.x2dev.sis.tools.reports.ReportJavaSourceDori#gatherData() protected JRDataSource gatherData() { // Another bunch of stuff... return new QueryIteratorDataSource(getBroker().getIteratorByQuery(query)); }

Other Methods /** com.x2dev.sis.tools.ToolJavaSource# * saveState(com.x2dev.sis.web.UserDataContainer) protected void saveState(UserDataContainer userData) { /* * If we're in the context of a single student, print the * report for just that student. */ m_currentStudent = (Student) userData.getCurrentRecord(Student.class); }

The gatherData() Formula Declare an instance of the Criteria type Add various filters based on user input Declare an instance of QueryByCriteria Add various sorts based on user input Execute the query and return the results

A Report’s “Root Table” Embedded in the “thing” returned at the end of gatherData() Defines what fields are available in the report format Might not be based on an actual table in the database

Finding the “Root Table” Guess Become a Java programmer and work at X2 Use heuristics

Using Heuristics In the format: Deduce from the fields that have already been defined In the Java source: Examine the return statement in gatherData() o If a QueryIteratorDataSource, find where the query is declared – that’s the root table o If a DataGrid, find where grid.set() is called – those are the fields in the root table

Exercise 1: Custom Sort Customize the Student List report by adding an option to sort the results by state ID.

Exercise 1, Step 1 <input name="sort" data-type="integer" display-type="select“ display-name="report.shared.sort"> <option value="0" display-name="report.shared.sort.currentSort“ context-dependent="true"/>

Exercise 1, Step 2 switch (sort) { case 0: // Current sort applyCurrentSort(query); break; case 1: // Name view query.addOrderByAscending(Student.COL_NAME_VIEW); break; case 2: // YOG query.addOrderByAscending(Student.COL_YOG); query.addOrderByAscending(Student.COL_NAME_VIEW); break; case 3: // Homeroom query.addOrderByAscending(Student.COL_HOMEROOM); query.addOrderByAscending(Student.COL_NAME_VIEW); break; case 4: // State ID query.addOrderByAscending(Student.COL_STATE_ID); query.addOrderByAscending(Student.COL_NAME_VIEW); break; default: // No sort specified break; }

Exercise 1, Step 3 Mark custom Compile Java source Save Test

Exercise 2: Custom Filter Customize the Student Contacts report by adding an option to filter the results by students’ last name (i.e., only return those students whose last name begins with a user-specified letter).

Exercise 2, Step 1 <input name="queryBy" data-type="integer" display-type="select“ display-name="report.shared.query"> <option value="0" display-name="report.shared.query.currentSelection“ context-dependent="true"/>

Exercise 2, Step 2 switch (queryBy) { case 0: // Current selection SubQuery subQuery = new SubQuery(Student.class, X2BaseBean.COL_OID, getCurrentCriteria()); criteria.addIn(StudentContact.COL_STUDENT_OID, subQuery); break; case 2: // YOG criteria.addEqualTo(StudentContact.REL_STUDENT + "." + Student.COL_YOG, getParameter(QUERY_STRING_PARAM)); break; case 3: // Homeroom criteria.addEqualTo(Student.COL_HOMEROOM, getParameter(QUERY_STRING_PARAM)); break; case 4: // Last name begins with criteria.addBeginsWithIgnoreCase(Student.COL_NAME_VIEW, getParameter(QUERY_STRING_PARAM)); break; default: // No additional criteria (this is the case for "All") break; }

Exercise 2, Step 3 Mark custom Compile Java source Save Test

Exercise 3: Related Data Customize the Student List report (again) by displaying the homeroom teacher’s name next to the student’s homeroom number on the format.

Adding an Option for “Current Selection” Adding an option to run a report based on the current selection of student records is detailed in knowledge base article K located in the session folder.

Thank you.