Ad Hoc Reporting with Pass-Through SQL Copyright © 2006, Infinite Campus, Inc. All rights reserved. Agenda 1. 2. 3. 4. Objectives Ad Hoc Reporting Tips and Tricks Finding Information Copyright © 2007, Infinite Campus, Inc. All rights reserved. Objectives 1. Learn about the three types of filters that can be created in Filter Designer and how to choose the best one for a given task 2. Understand the data types available and how filter options can assist you in searching for information 3. Learn how to design a Custom Form Letter, containing Data Elements, in the Report Designer 4. Combine an Ad Hoc filter and a Custom Form Letter in Report Builder 5. Learn what the Data Export tool is used for Copyright © 2007, Infinite Campus, Inc. All rights reserved. Ad Hoc Reporting Module The Ad Hoc Reporting Module has five parts. We will review the first four. (Cube Designer is an advanced feature that is discussed in another session.) • • • • The Filter Designer is used to select data from Campus The Report Designer is used to create custom reports (form letters) The Report Builder allows you to join Filters with Reports The Data Export Tool is used to export data from saved Filters Copyright © 2007, Infinite Campus, Inc. All rights reserved. Filter Designer The Filter Designer provides three ways to filter data Query Wizard Selection Editor Pass-through SQL Query There are three types of data from which the user can select Student Census/Staff (person) Course/Section (curriculum) Copyright © 2007, Infinite Campus, Inc. All rights reserved. Filter Designer – Query Wizard The Query Wizard allows a user to generate dynamic custom searches on any of the three data types. Copyright © 2007, Infinite Campus, Inc. All rights reserved. Query Wizard Fields The Query Name should be descriptive. Select all of the fields that will be used as filter criteria or that you would like displayed on the output. Fields in the blue list on the left expand, making thousands of possible filter combinations. Copyright © 2007, Infinite Campus, Inc. All rights reserved. Finding your Fields TO FIND: LOOK IN: Transcript information Learner Portfolio > Transcript Detail Student enrollment and schedules Learner > Schedule Medical flags Learner > Programs Learner > Active Enrollment > Special Ed elements OR Learner > Enrollment History > Special Ed elements Special Ed status Person GUID or Guardian information Census > Contact Summary Copyright © 2007, Infinite Campus, Inc. All rights reserved. Query Wizard Filter Options The Query Wizard uses of Filter Options to narrow your search: Equal or Not Equal (=, <>) IN, NOT IN LIKE SOUNDS LIKE IS NULL, IS NOT NULL For numeric values: >, >=, <, <= For dates: IS TODAY, IS YESTERDAY • Use the Organized To field to save the filter for your own use or share it with other User Groups you belong to. © 2007, Infinite Campus, Inc. All rights reserved. • Use the Help tab whileCopyright in the Wizard for a description of each option. Filter Option Examples 1. Filter students in grade 9 or 12 IN – using commas (no space) student.grade IN 09,12 2. Filter on students with a last name that Sounds Like - as. (Filter could return az, as, aas) student.lastName SOUNDS LIKE as 3. Find students that do not have certain information entered into Campus. (i.e. birthdates, race ethnicity, middle name ) Is Null student.birthdate IS NULL 4. Find people who have unwanted information entered into Campus. Is Not Null student.ssn IS NOT NULL Copyright © 2007, Infinite Campus, Inc. All rights reserved. The LIKE Option Uses Wildcards % matches a string of zero or more characters student.lastName LIKE Mc% will find all names that begins with “Mc” student.lastName LIKE %en% will find all names that includes the letters “en” (Bennet, Green, McBadden) _ matches one character student.lastName LIKE Anders_n will find “Anderson” and “Andersen” but not “Andersohn” [ ] matches each single character enclosed in the brackets student.lastName LIKE [ABCD]% will find every name beginning with A, B, C or D student.lastName LIKE [CKL]ars[eo]n ^ will find “Carsen”, “Karsen”, “Larsen”, “Carson”, “Karson” and “Larson” when used with square brackets, it means NOT student.lastName LIKE M[^c]% will find all names beginning with M that do not have c as the second letter Copyright © 2007, Infinite Campus, Inc. All rights reserved. Query Wizard Output Click on the Test button to see the results of your Query: Output can be pasted into a spreadsheet for further manipulation or printed as is. Copyright © 2007, Infinite Campus, Inc. All rights reserved. Filter Designer – Selection Editor The Selection Editor creates a static list of individually selected Students. Copyright © 2007, Infinite Campus, Inc. All rights reserved. Selection Editor Students are chosen from a list of all students in the selected Calendar. Since the list is static, any changes must be made manually. Copyright © 2007, Infinite Campus, Inc. All rights reserved. Filter Designer – Pass-through SQL Query A Structured Query Language pass-through filter can be created on any data type. To use this filter type you need knowledge of the Campus database schema and SQL, a database programming language. Copyright © 2007, Infinite Campus, Inc. All rights reserved. SQL Query Editor Creates a SQL SELECT statement Returns only these fields: lastName, firstName, grade, studentNumber Copyright © 2007, Infinite Campus, Inc. All rights reserved. SQL Syntax SELECT FROM (A) A list of the database Tables or Views the Fields come from and how they are related to each other WHERE (B) A list of the Fields that will be returned Conditions that must be met for data to be returned Example: Students with enrollment dates outside of their Calendar: SELECT DISTINCT student.personID FROM student INNER JOIN Calendar c ON c.calendarID = student.calendarID WHERE student.calendarID = <selected Calendar> AND (student.startDate <= c.startDate OR (student.endDateCopyright >= ©c.endDate OR student.endDate IS NULL)) 2007, Infinite Campus, Inc. All rights reserved. Joins SELECT DISTINCT student.personID FROM student INNER JOIN Calendar c ON c.calendarID = student.calendarID WHERE student.calendarID = 46 AND student.endDate > c.endDate Student INNER JOIN (fields must match in both tables) Students with bad end dates: X X X LEFT OUTER JOIN (all fields in first table even X X X X X X X X Student if there is no matching field in the second table) Calendar X X v_CensusContactSummary Students without Guardians: SELECT DISTINCT student.personID FROM student LEFT OUTER JOIN v_CensusContact Summary v ON v.personID = student.personID AND v.guardian = 1 WHERE student.calendarID = 46 AND v.personID IS NULL X X X X Copyright © 2007, Infinite Campus, Inc. All rights reserved. X X X X X X X X X SQL Query Examples Students in 12th Grade with less than 20 credits. A: INNER JOIN v_transcriptdetail v ON v.personID = student.personID B: AND student.grade = '12' GROUP BY student.personID, student.lastName, student.firstName, student.grade, student.studentNumber HAVING(SUM(v.creditsearned)) <20 Copyright © 2007, Infinite Campus, Inc. All rights reserved. SQL Query Examples Birthdates in a specific range A: Nothing B: AND student.birthDate BETWEEN '5/1/1991' AND '5/31/1991‘ Birthdays in a month A: Nothing B: AND month(student.birthDate)=’02’ Courses without a certain task A: INNER JOIN gradingtaskcredit gtc ON gtc.courseID = course.courseID AND gtc.calendarID = course.calendarID B: AND gtc.taskID <> 56 Copyright © 2007, Infinite Campus, Inc. All rights reserved. SQL Query Examples Requested Course that students did not get A: INNER JOIN request r ON r.personID = student.personID AND r.calendarID = student.calendarID INNER JOIN course c ON c.courseID = r.courseID and c.number ='0355‘ INNER JOIN [section] s ON s.courseID = c.courseID LEFT OUTER JOIN roster ro ON ro.personID = r.personID AND ro.sectionID = s.sectionID B: AND ro.personID IS NULL Copyright © 2007, Infinite Campus, Inc. All rights reserved. Why use Pass-through Queries when I have the Query Wizard? Allows you to search for data in a more customized way Allows you to search on Tables, Views and Fields not available in the Query Wizard Fields list Allows you to use SQL operators such as BETWEEN for birthdates, or SQL functions such as or HAVING(COUNT()) to count a student’s credits Copyright © 2007, Infinite Campus, Inc. All rights reserved. Report Designer Report Designer allows districts to create their own custom reports or letters using a WYSIWYG editor. Once the reports have been saved, users can use the Report Builder to generate the printed version of the report. Copyright © 2007, Infinite Campus, Inc. All rights reserved. A Custom Report Type the layout of the report in the text field, adding Campus Fields and Sub-Reports where needed. Letters can be shared with other users by choosing a group in Organized To. Copyright © 2007, Infinite Campus, Inc. All rights reserved. Report Builder Filters and Reports are joined together in the Report Builder. If you wish to use more than one Filter, you can choose Union or Intersection in the Set Operation field. Union Intersection (all Dodgeball Team members and all 10th grade boys) (Dodgeball Team members who are also 10th grade boys) X X X X X X X X X X X X X X X X X Copyright © 2007, Infinite Campus, Inc. All rights reserved. X X X X X X X X X Building a Report The Campus Fields will populate with the desired information. The letters can then be printed and distributed. Copyright © 2007, Infinite Campus, Inc. All rights reserved. Data Export The Data Export tool is used to export data from filters that were created with the Query Wizard in several formats. HTML opens a browser pop-up window XML is a Web language used by computer programs Comma Separated Values and Tab delimited Values can be used in a program such as Excel PDF report can be saved and printed, but not edited Copyright © 2007, Infinite Campus, Inc. All rights reserved. More Uses for Ad Hoc Filters Mailing Labels Census > Reports > Mailing Labels Ad Hoc Filter dropdown list will contain all your saved filters Other reports Similar to Mailing Labels Advanced Search Search tab Search for a Student Advanced Search >> Select a Saved Filter from the list and click the Search button Copyright © 2007, Infinite Campus, Inc. All rights reserved. Tips In Query Wizard, deselect a Filter Option when you remove a criteria from the right hand box Active students student.activeToday = 1 (check box or Y/N values are recorded as 1 or 0) Certain fields are stored as code numbers rather than descriptions. Look at Campus dropdown lists to determine how to search for your desired results. Example: for non-White students, student.raceEthnicity <> 5 Copyright © 2007, Infinite Campus, Inc. All rights reserved. Activities – Attendance Create a Daily Approximation filter to find all students who are absent today. Try yesterday too. Filter on Ethnicity as well Decide on the type of Demographic, Attendance, and Date filters to use. Copyright © 2007, Infinite Campus, Inc. All rights reserved. Activities – Attendance Hints Fields from Demographics: firstName, lastName. Fields from Attendance>Daily Approx Detail: Date. Filter on date IS YESTERDAY/IS TODAY. Copyright © 2007, Infinite Campus, Inc. All rights reserved. Activities – Attendance Create a filter that pulls 10th and 11th grade students with 15 or more period absences and 10 or more course absences. Hint Students should be Active Copyright © 2007, Infinite Campus, Inc. All rights reserved. Activities – Grades Students with Ds & Fs this Term: Student > Demographics student.lastName LIKE [ABCDEFG]% student.firstName student.middleName student.grade = 09 (whatever grade level you choose) Copyright © 2007, Infinite Campus, Inc. All rights reserved. Activities – Grades Students with Ds & Fs this Term – Cont: Student > Grading grading.courseNumber grading.courseName grading.sectionNumber grading.teacherDisplayname grading.termName grading.task grading.score IN D-,D,D+,F Copyright © 2007, Infinite Campus, Inc. All rights reserved. Activities – Grades Find grade 10 female students whose last names begin with letters between F and M who took courses whose names begin with Wo or We who have a Term 2 GPA of 4.0. Hint – The name ranges require wildcard entries L[ae]% finds names that start with La or Le LIKE [ABCDEFG]% Between A and G Copyright © 2007, Infinite Campus, Inc. All rights reserved. Extra Activity Create a filter that pulls absences for students < 16 years. Hint – Students over 16 not needed Copyright © 2007, Infinite Campus, Inc. All rights reserved. Questions 1. How would you design a filter in the Query Wizard that will allow us to search or build a report for all ethnic minorities? 2. How would you build the list of students in debate? 3. Name one way you could benefit from using the Ad Hoc Report module. Copyright © 2007, Infinite Campus, Inc. All rights reserved.