sqlReports for 6.x

sqlReports is an ad hoc reporting add-on that can turn simple to medium sql queries in to web based reports in PowerSchool. Essentially, you would create a sql query in your favorite query tool then copy and paste the query in to sqlReports.  You also can use up to 5 different parameters to make the reporting more flexible. NOTICE: This is a PowerSchool 6.x only customization...though I am not opposed to someone hacking it to work with 5.x. But c'mon, who wants to work in 5.x?  In the past, it was necessary to "tag" the query by using a lot of concatenation.  With this latest version (2.0) you shouldn't have to worry about that anymore.  And, your old queries with "tags" should still work too.

Here is a video of version 1.1 to get you started: http://www.rschooltoday.com/school608/genie198/images/files/howtocreatea...

5
Your rating: None Average: 5 (1 vote)

Comments

sqlReports V 2.0 is awesome!

5

I'm loving v 2.0 which I finally decided to take the time to merge with the old one included in the reports bundle. I've got it properly merged now and it'll be in the next bundle release. Very cool Dean!

Jason

No records found with query that worked in SQL Developer

I have been trying to do a query using a custom field and searching for text in that field ( upper case NI).  I finally have the sql query working in sql Developer but when I cut it and paste it into the sql reports, I receive "No records found."  My custom field is

xai_2_tier_1_inter

The query that I am using is:

Select s.last_name, s.first_name,s.grade_level, s.home_room, ps_customfields.getstudentscf(id, 'xai_2_tier_1_inter') as Tier_I_Intervention
from students s
where s.grade_level=2 AND ps_customfields.getstudentscf(id, 'xai_2_tier_1_inter')like '%NI%'
order by s.home_room

Do you have any idea where I might be going wrong?

This is the query with the tags in it in case I have an error in there.

Select '<td>'|| s.last_name||'</td><td>'|| s.first_name||'</td><td>'||s.grade_level||'</td><td>'|| s.home_room||'</td><td>'|| ps_customfields.getstudentscf(id, 'xai_2_tier_1_inter') as Tier_I_Intervention||'</td>'
from students s
where s.grade_level=2 AND ps_customfields.getstudentscf(id, 'xai_2_tier_1_inter')like '%NI%'
order by s.home_room

I am afraid that I can't use custom fields with this.  Is that so?  Thanks so much. 

RE: No records found...

I think it's probably the 'as Tier_I_Intervention' part in the select that it doesn't like.  Try leaving that off and see if you get anything. 

Also, in your where part, I'd put a space before the word like so that it separates it from the right parenthesis and have any problems with it.

Matt

Make current selection not working

This solved my problem and the report is running well now.  The only problem that I am having is that I can't make the list my current selection.  Is this because that I a custom table in addition to the student's table?

Thanks so much for this.  It is great.

My superintendent has asked me if I can include a student photo.  Is that possible with this feature or do I need to make an object report?

Thanks for sharing such a dynamic tool!

re: Make current selection not working

Making the list a current selection shouldn't care that you are using custom information. Did you alias the field correctly after letting the system make your query?

As for pictures, if Dean made something that pulls pictures that's pretty cool, but I don't see a way of pulling them using SQL.

Jason

Make your Current Selection

I just put this on my server - very cool. Your sample has the 'Create Student Selection' item active.
But when I test it, it doesn't work.
Anything I could have done to cause, or can do to fix?

Hmm...the sample shouldn't

Hmm...the sample shouldn't have had the "student selection" active since it was using the Gen table and not the Students table. Student selection should work for a normal students query. Try a really simple query like: select lastfirst from students where enroll_status=0 and grade_level=6. I think you will get the hang of it pretty quickly. Yell if you have more questions.

Dean.

Another question from me!

I am writing a fee report that is customized to our needs. This is the code that works:
SELECT FEE.DATE_VALUE, FEE.FEE_PAID, FEE.YEARID, FEE.SCHOOLID, FEE.COURSE_NAME, FEE.COURSE_NUMBER, FEE.DEPARTMENT_NAME, FEE_TYPE.NAME, FEE.DESCRIPTION, FEE_TYPE.DESCRIPTION
FROM PS_MGMT.FEE FEE, PSNAVIGATOR.FEE_TYPE FEE_TYPE
WHERE FEE_TYPE.ID = FEE.FEE_TYPE_ID AND ((FEE.FEE_CATEGORY_NAME='Activity'))
ORDER BY FEE.DATE_VALUE

I would like to sum the FEE.FEE_PAID column, but the Excel ODBC program will not let me use the sum function in the application. I get the following error:
FROM keyword not found where expected

Could anyone help out with this? Thank you so much!!

JoAnne Smith
Batavia Public Schools
Batavia, IL

JoAnne, are you looking to

JoAnne, are you looking to use sql above in sqlReports or in an excel query? Be sure if you are using a group function like SUM that you include a GROUP BY clause in your sql.

Dean.

Open in a new window

Dean -

Firstly, I would like to thank you for putting this together... since installing it late last year, I've made extensive use of this add-on for various reporting needs - it has in fact become my primary reporting tool thus far. I'm a HUGE fan!!! :-)

Secondly, are you planning on any further development? If so, I wonder if you'd consider a request/suggestion? When a report is configured to open in a new window, it would be great if there was a way to suppress the PowerSchool Header and navigation links down the left side of the page so that the report can be printed without that extra clutter.

Thanks again!

Open in a new window

Thanks Brian...I like your idea. I am hoping to have a newer release out soon. The new release would not require the tagging. This would allow the sql to move more easily from user to user and from sqlReports to sql developer or other query tool.

Let me see what I can do.

Dean.

Request for student grade report

Our Jr.High counselors need a list of 7th grade students identifying their current math class and the Q1, Q2 and Q3 grades. They use the list to determine who should take Algebra in grade 8. I was able in SASI to export the data to Excel and am sure there must be a way in SQL to get the data, but I'm at a loss as to how to begin. I am just beginnng to learn my way through SQL and would appreciate any help. I am so grateful to have this site!!

Sue Todd
Technology Coord
Hopewell Area School District

Request for student grade report

Sue, try this for starters...it isn't fancy, but it might get the job done. This plain sql is how I would get the info for my middle school. You will need to change the course_number to either just one number or a list of numbers (similar to the list of storecodes). Play around a see what happens.

select s.lastfirst, sg.course_number, sg.course_name, sg.storecode, sg.grade
from storedgrades sg, students s
where s.id=sg.studentid
and sg.termid>=1900
and sg.storecode in ('Q1','Q2','Q3')
and sg.grade_level=7
and sg.course_number='JH2010'
order by s.lastfirst, sg.storecode

Thanks.

Dean.

Student Selection Build Query

I love this tool. I am also very new to it (started playing yesterday). Anyway, I am having trouble making the current selection of students work. This is what I have for my SQL Query (and it works for me):

SELECT ' '|| STUDENTS.LASTFIRST||' '|| STUDENTS.GRADE_LEVEL||' '|| COURSES.COURSE_NAME||' '|| PGFINALGRADES.GRADE||' '|| PGFINALGRADES.FINALGRADENAME||' '|| TEACHERS.LASTFIRST
||'

'
FROM PSNAVIGATOR.CC CC, PS.COURSES COURSES, PS_MGMT.PGFINALGRADES PGFINALGRADES, PS_MGMT.STUDENTS STUDENTS, PS.TEACHERS TEACHERS
WHERE STUDENTS.ID = CC.STUDENTID AND STUDENTS.ID = PGFINALGRADES.STUDENTID AND CC.COURSE_NUMBER = COURSES.COURSE_NUMBER AND TEACHERS.ID = CC.TEACHERID AND ((STUDENTS.SCHOOLID=20001) AND (CC.TERMID=1902) AND (PGFINALGRADES.GRADE='D') AND (PGFINALGRADES.PERCENT<70) AND (PGFINALGRADES.FINALGRADENAME='S2') OR (CC.TERMID=1905) AND (PGFINALGRADES.GRADE='F') AND (PGFINALGRADES.FINALGRADENAME='T3'))
ORDER BY STUDENTS.LASTFIRST

I would like to make the students the current selection and am not having much luck. This is what I tried:

SELECT DISTINCT students.lastfirst, cc.sectionid, pgfinalgrades.grade,
pgfinalgrades.finalgradename
FROM CC, COURSES, PGFINALGRADES, STUDENTS, TEACHERS
WHERE
STUDENTS.ID = CC.STUDENTID
AND STUDENTS.ID = PGFINALGRADES.STUDENTID
AND CC.COURSE_NUMBER = COURSES.COURSE_NUMBER
AND TEACHERS.ID = CC.TEACHERID
AND ((STUDENTS.SCHOOLID=20001) AND (CC.TERMID=1902) AND
(PGFINALGRADES.GRADE='D') AND (PGFINALGRADES.PERCENT<70) AND
(PGFINALGRADES.FINALGRADENAME='S2') OR (CC.TERMID=1905) AND
(PGFINALGRADES.GRADE='F') AND (PGFINALGRADES.FINALGRADENAME='T3'))

Thank you for all of your hard work!!!!!

JoAnne Smith
Batavia Public Schools
Batavia, IL

Change your student

Change your student selection query to only get the student dcids.

SELECT DISTINCT students.DCID
FROM...

Brent Johnson
Database Specialist, Programmer
Traverse Bay Area ISD

Brent is right on the money.

Brent is right on the money. The DCID field is what we are looking for. You should be able to use the Build Query link to the left of the text box to help with this too. The caveats with the Build Query link are that it is not smart enough to know the alias for the Students table. It also has trouble with an Order By clause...a javascript pop-up box will remind you.

Thanks.

Dean.

It worked!

Thank you all for your help! It works--what a fantastic tool!

JoAnne Smith
Batavia Public Schools
Batavia, IL

question

Fairly new to PowerSchool and very new to sql reports. I've added this customization and a few other reports from colleagues. Everything runs but the column headings are all shifted to the right by a tab. I've re-applied the customization but I'm not sure where else to look. Suggestions?

Thanks,
Andrea

Andrea Stetson
Botetourt County Schools

question

Andrea, is it possible to send me a screen shot of what you are describing? I am not aware of anyone else experiencing this type of issue. Let's see if we can get this cleared up.

Thanks.
Dean.

ddahlvan@proctor.k12.mn.us

Love this tool

I have a question about using things like per.att in this tool. I read somewhere that it would work if it is put inside single quotes. I have tried that but I don't get a valid count. I am using the example you posted that lists the students courses and am trying to list absences instead. The currentabsences in the cc record does not seem to be accurate.
any ideas???
thanks!
Max B

Attendance in a query

Max, I am not sure about the per.att inside a sql query. I don't know if I would trust the results. My guess is that you will need to make a subquery of one of the attendance views to see the totals you are looking for. And, you are right, the info in the CC table was legacy information to my knowledge and is not functioning anymore...I think.

Thanks.

Dean.

thanks for your reply

Thanks, Dean, I did in fact write a query from a view and got it working but when I moved it to sql reports it doesn't work. I used the COUNT() AS to count records with an A code and it matches the data from the quick lookup.
Is the COUNT command messing me up?

Max B
Data Applications Specialist
Colonial Beach, VA

Re: thanks for your reply

Don't use AS, this is called aliasing and won't work with sql reports. So if I have "count(a.id) as something" just use "count(a.id)" in sql reports.

took out the AS

I took out the AS and it works great in sql developer but still not in sql reports. Here is my code.

SELECT DISTINCT(s.lastfirst), s.student_number, psa.period_number, COUNT(PSA.att_code)
FROM PS_ATTENDANCE_MEETING PSA
INNER JOIN Students s
on s.ID = PSA.StudentID
WHERE PSA.STUDENTID = S.ID AND PSA.ATT_CODE = 'A' AND psa.att_date > '07-SEP-09'
GROUP BY s.lastfirst, s.student_number, psa.period_number ORDER BY s.lastfirst

Max B
Data Applications Specialist
Colonial Beach, VA

DISTINCT is stinking up the works

Max, I think the DISTINCT is causing the problem. I ran your query on my server and got the same results (number of records) with the DISTINCT and without it. I am wondering if you can remove it and then re-tag your sqlReport.

My guess is that when you try to include the DISTINCT in a concatenated string it fouls up the works. This might be a bug down the road...but in your case, I think you can do without it...maybe =)

Good luck!

Dean.

Thanks for all of your help,

Thanks for all of your help, but believe it or not it still will not run. I have 12 other sql reports that work but this one doesn't seem to like me. I will keep working on it because I'm anal like that!
thanks again and I still love this tool!

Max B
Data Applications Specialist
Colonial Beach, VA

Re: Thanks for all of your help,

Try this;

SELECT DISTINCT ' '||(s.lastfirst)||' '|| s.student_number||' '|| psa.period_number||' '|| COUNT(PSA.att_code)||'

'
FROM PS_ATTENDANCE_MEETING PSA
INNER JOIN Students s
on s.ID = PSA.StudentID
WHERE PSA.STUDENTID = S.ID AND PSA.ATT_CODE = 'A' AND psa.att_date > to_date('07-SEP-09', 'DD-MMM-YY')
GROUP BY s.lastfirst, s.student_number, psa.period_number ORDER BY s.lastfirst

Can you use the parameter feature for date range

I would like to be able to use the %param% to let the end user specify a date range. Specifically so they can pull discipline reports by an incident date range. Is there a way to do this using the %param% feature?

Thanks, Dean...this has already been a huge help in writing reports.

Date Ranges and Parameters

Jane, I will post a quick screen shot of how I would use the %param% feature in a date range. The trick is to remember the to_date function =)

You should see it listed above as sqlReportsDateRangeExample.jpg

Thanks!

Dean.

Date Ranges

Dean,

THANK YOU!!!! I am going to be sooo productive and my schools are going to be sooo happy!

I'm just a little excited!!!

Thanks,
Jane

Hi, I have just downloaded

Hi, I have just downloaded sqlReports and test with the query below (this query get the average for stored grades and pivot it to better display). However I always have a Records nor found message. The query works fine in SQLDeveloper. Any ideas will be much appreciated.

select course_name, max(decode(storecode,'P1',Promedio,Null)) AvgP1,
max(decode(storecode,'E1',Promedio,Null)) AvgE1,
max(decode(storecode,'S1',Promedio,Null)) AvgS1
from(
SELECT course_name,storecode,cast(avg(percent)as decimal (20,2)) Promedio
FROM STOREDGRADES
where (storecode='P1' or storecode='E1' or storecode='S1')
and schoolid='1234'
and termid='1901'
GROUP BY course_name, storecode
order by course_name
)
group by course_name

This has tricked me in the

This has tricked me in the past too. My tool doesn't handle aliasing very well. I your query you have:

select course_name, max(decode(storecode,'P1',Promedio,Null)) AvgP1,
max(decode(storecode,'E1',Promedio,Null)) AvgE1,
max(decode(storecode,'S1',Promedio,Null)) AvgS1
...

change this to:

select course_name, max(decode(storecode,'P1',Promedio,Null)),
max(decode(storecode,'E1',Promedio,Null)),
max(decode(storecode,'S1',Promedio,Null))

essentially you are removing the AvgP1, AvgE1 and AvgS1 aliases...these can go in the header area of sqlReports.

Good luck!

Dean.

Thanks again...

Dean,

Thanks again for your suggestions. This worked great! My SQL is quite rough, but this accomplishes in seconds what was taking days with a pivot table!

Thank you!!!!

Jim

Samples???

Does anyone happen to have any examples that might help to export a "student schedule" one line that contains student demographic information and Period 1-8 schedule information. Have tried using an ODBC connection and pivot table, but takes forever to process. This seems like it would work great, but need some samples to get me going. Any other ideas would be helpful.

Thanks!

Samples???

Jim, would this get you started?

SELECT
q.studentid,
s.lastfirst,
MAX(CASE WHEN p# = 1 THEN q.course_name
ELSE NULL END),
MAX(CASE WHEN p# = 2 THEN q.course_name
ELSE NULL END),
MAX(CASE WHEN p# = 3 THEN q.course_name
ELSE NULL END),
MAX(CASE WHEN p# = 4 THEN q.course_name
ELSE NULL END),
MAX(CASE WHEN p# = 5 THEN q.course_name
ELSE NULL END),
MAX(CASE WHEN p# = 6 THEN q.course_name
ELSE NULL END),
MAX(CASE WHEN p# = 7 THEN q.course_name
ELSE NULL END),
MAX(CASE WHEN p# = 8 THEN q.course_name
ELSE NULL END)
FROM
(SELECT cc.studentid, cc.id, cc.expression, c.course_name, rank() OVER
( PARTITION BY cc.studentid ORDER BY cc.expression ) as p#
FROM cc cc, courses c
WHERE c.course_number=cc.course_number
and cc.termid in (1900,1901,1903,1904)
and cc.schoolid=1
and cc.sectionid>0) q, students s
WHERE s.id=q.studentid
GROUP BY q.studentid, s.lastfirst ORDER by q.studentid

This is the native sql that I got to work in sqlReports. You would need to watch the termid/schoolid, etc for your environment.

Samples

If I needed to add the course number to the course name as well as additional student information - is that possible? I have been working on it, unsuccessfully (so far), but I thought I would see if was even possible before I put much more time into it.

Thanks again.

student and course additions

Yes, you should be able to add student fields like normal since the Students table is "linked". As for course_number, I think I would concatenate this with the course_name in the embedded select statement. Course number is tricky since it is another field dependent on the period...that is why I think I would put course_number and course_name in to one field in the embedded select. I think it makes it easier for the MAX CASE statements. I am definitely not an SQL pro. There might be someone out there with better solution!

Dean.

Another sample...

Dean,

This is great - I have been able to use this for many reports... Do you have any samples that would also pull data from fields on a custom student screen?

Thanks,

Jim Ohlensehlen

Samples

This is PERFECT!!!! Thanks for your help!!!

Awesome customization! Thank you!

This is a fantastic tool for adding custom reports easily into PowerSchool. Using the basic SQL skills I learned at the Michigan System Administrator's Conference, I have used this add on to create several custom reports including data validation reports for Michigan Pupil Accounting (state reports).

The video link was a perfect intro to get me started. Thanks for posting it!

Laurie Kinney

Thanks Laurie! I originally

Thanks Laurie! I originally created this to help with my own state reports. I would like to use a line or two of Brian Andle code to provide an option to see certain queries in a dashboard format. I know this would help my data validation for Minnesota.

Happy Holidays!

Dean.

Sql Query Text Box character limit?

Is there a character limit to what can be entered into the SQL Query Text Box?

Also is there a way I can create an exported report file for import?

Robert Wadsworth

Robert, I want to venture a

Robert, I want to venture a guess of 32k for the text box size. I have not run in to a limitation yet.

Also, you can export a report to be imported later. There might be a "gotcha" if you are using any of the PowerSchool data tags like ~(curschoolid) or something like that. These might populate with real data instead of keeping the ~(curschoolid) format. To export a report, just edit it and choose the export option at the bottom of the edit page.

I hope you can find some use for sqlReports. It has worked well for me.

Dean.

~(curschoolid) has got me

I'm having trouble as you stated above with the ~(curschoolid) storing actual data. It then won't allow the report to show up at other schools once one school has run it. Have you got a workaround? It was running fine before I imported the custom Reports bundle. Once I imported it all of my sql reports disappeared so I had to import them from my test database.

I LOVE this package but if I can't get it to work using ~(curschoolid) or other internal PS commands I'll be REALLY disappointed. I've become an expert at the quick little sql report!

Jill Anderson
Data Analyst/Lead Report Writer
Park Hill School District
Kansas City, MO

latest version

Jill, I think this was an issue in the first release of sqlReports. Be sure to check the version info of sqlReports at the bottom of the help page. You should be running on v1.1.

Thanks!

Dean.

~(curschoolid) still causing issues

Dean,

I am on the latest version yet when I create a SQL report it shows for all schools. Once I go into a school and run it, the report then disappears from the other schools. I am on running 1.1. Please help.

Kevin

sqlReports for 6.x version 1.10

I have uploaded a new version of sqlReports (v1.10). Not much has changed but I did clean up a few things. I also added a report that can be imported as a sample. This report will basically show you a run history of all of your created sqlReports. So, down the road, if you are wondering "Does the principal really use this report?", you can execute the Run History and find out.

And let's see if this works. Here is a link to a video to help get you started with sqlReports:

http://www.proctor.k12.mn.us/infotech/swf/HowToCreateAsqlReport.swf

Update SQL statement?

Can this be used to issue update SQL statements?

Re: Update SQL statement?

No it can not, also attempting/using SQL write access is a violation of your license and support contract. If Pearson was to find out you found a way to issue these types of statements, they have the right to cancel your support contract and stop supporting you.

Brian Andle

SQL to display web gradebook final grade setups

SELECT ' '|| T.LastName||' '||
T.FirstName||' '||
SC.Description||' '||
S.SectionIdentifier||' '||
FGS.FinalGradeSetupType||' '||
P.Q1||' '||
P.Q2||' '||
P.Q3||' '||
P.Q4||' '||
P.E1||' '||
P.E2||' '||
P.R1||' '||
P.R2
||'

'
FROM PSM_FinalGradeSetup FGS
INNER JOIN
psm_Section S ON S.ID = FGS.SectionID
INNER JOIN
psm_ReportingTerm RT on RT.ID = FGS.reportingTermID
INNER JOIN
PSM_SectionTeacher ST ON ST.SectionID = S.ID
INNER JOIN
PSM_Teacher T ON T.ID = ST.TeacherID
INNER JOIN
psm_SchoolCourse SC on SC.ID = S.schoolcourseid
INNER JOIN
psm_School SCH on SCH.ID = S.SchoolID
LEFT JOIN

(SELECT FGS.GradingFormulaID,
MAX(CASE RTRIM(RT.name) WHEN 'Q1' THEN GFW.weighting ELSE NULL END) AS Q1,
MAX(CASE RTRIM(RT.name) WHEN 'Q2' THEN GFW.weighting ELSE NULL END) AS Q2,
MAX(CASE RTRIM(RT.name) WHEN 'Q3' THEN GFW.weighting ELSE NULL END) AS Q3,
MAX(CASE RTRIM(RT.name) WHEN 'Q4' THEN GFW.weighting ELSE NULL END) AS Q4,
MAX(CASE RTRIM(RT.name) WHEN 'E1' THEN GFW.weighting ELSE NULL END) AS E1,
MAX(CASE RTRIM(RT.name) WHEN 'E2' THEN GFW.weighting ELSE NULL END) AS E2,
MAX(CASE RTRIM(RT.name) WHEN 'R1' THEN GFW.weighting ELSE NULL END) AS R1,
MAX(CASE RTRIM(RT.name) WHEN 'R2' THEN GFW.weighting ELSE NULL END) AS R2
FROM psm_GradingFormulaWeighting GFW
INNER JOIN
psm_ReportingTerm RT on RT.ID = GFW.reportingTermID
INNER JOIN
psm_GradingFormula GF on GF.ID = GFW.ParentGradingFormulaID
INNER JOIN
PSM_FinalGradeSetup FGS on FGS.GradingFormulaID = GF.ID
WHERE RT.startDate >= TO_DATE('%param2%','MM/DD/YYYY')
GROUP BY FGS.GradingFormulaID) P
ON P.GradingFormulaID = FGS.GradingFormulaID
WHERE SCH.abbreviation = '%param1%'
AND RT.startDate >= TO_DATE('%param2%','MM/DD/YYYY')
AND RT.name = 'F1'
ORDER By T.LastName , t.FirstName, SC.Description, S.SectionIdentifier

Syndicate content Syndicate content