Hello,
Using Power nightly of 06-30-2011.
I have a field like this:
It calculates the number of lectures a student attended, as a percentage.
This query runs, but the $criteria.CourseEdition_id is not resolved, see the logs:
Here is the operationbinding that is being called for this particular fetch:
Is this because it is not possible? Do I have to put the subquery in the <selectClause> instead?
Using Power nightly of 06-30-2011.
I have a field like this:
Code:
<field name="attendancePercentage" type="float" customSelectExpression="(SELECT COUNT( * ) FROM Lecture_presence_student AS lps INNER JOIN Lecture AS l ON l.Lecture_id = lps.Lecture_id WHERE l.CourseEdition_id = '$criteria.CourseEdition_id' AND lps.status='aanwezig' ) / (SELECT COUNT( * ) FROM Lecture_presence_student AS lps INNER JOIN Lecture AS l ON l.Lecture_id = lps.Lecture_id WHERE l.CourseEdition_id = '$criteria.CourseEdition_id' AND lps.status != 'onverwerkt')*100" />
This query runs, but the $criteria.CourseEdition_id is not resolved, see the logs:
Code:
=== 2011-07-11 13:04:41,178 [l0-3] DEBUG SQLDataSource - [builtinApplication.fetchSubscriptionDetail] Using SQL Limit query === 2011-07-11 13:04:41,178 [l0-3] DEBUG SQLDataSource - [builtinApplication.fetchSubscriptionDetail] SQL windowed select rows 0->75, result size 75. Query: SELECT CourseEdition_students_Student.cb2_thesis_title, CourseEdition_students_Student.cb4_status_practical, Student.phone, (SELECT COUNT( * ) FROM Lecture_presence_student AS lps INNER JOIN Lecture AS l ON l.Lecture_id = lps.Lecture_id WHERE l.CourseEdition_id = '$criteria.CourseEdition_id' AND lps.status='aanwezig' ) / (SELECT COUNT( * ) FROM Lecture_presence_student AS lps INNER JOIN Lecture AS l ON l.Lecture_id = lps.Lecture_id WHERE l.CourseEdition_id = '$criteria.CourseEdition_id' AND lps.status != 'onverwerkt')*100 AS attendancePercentage, CourseEdition_students_Student.cb1_POK_graduationdate, Student.sofinummer, Student.street, Student.surname, CourseEdition.endDate, Student.city, CourseEdition_students_Student.Student_id, Student.voorletter, CourseEdition_students_Student.cb2_remarks, Student.cellphone, Student.gender, Student.number_addition, CourseEdition_students_Student.cb3_regular_extraneus, CourseEdition.editionName, CourseEdition_students_Student.students_id, Student.tussenvoegsel, CourseEdition_students_Student.cancelled, CourseEdition_students_Student.studentMarkOff, Student.number, Student.postcode, Student.country, CourseEdition_students_Student.cb1_POK_postponed, CourseEdition.MoodleCourse_id, Student.birthplace, Student.email, Student.Moodle_id, CourseEdition.Course_id, Student.active, CourseEdition_students_Student.cb2_defense_date, Student.userAccount, CourseEdition_students_Student.CourseEdition_id, CourseEdition_students_Student.cb2_thesis_accepted, CourseEdition.startDate, CourseEdition_students_Student.cb4_status_theory, CourseEdition_students_Student.cb1_OO_checkbox, CourseEdition_students_Student.cb1_OO_date, CourseEdition_students_Student.cb3_teaching_plan, CourseEdition_students_Student.cb1_POK_date, Student.archived, Student.birthdate, CourseEdition_students_Student.cb2_graduated_cancelled, CourseEdition.published, CourseEdition_students_Student.waitinglist, CourseEdition_students_Student.cb3_exam_regulations, CourseEdition_students_Student.cb2_planned_thesis_date, CourseEdition.percentageOfSubscriptions, CourseEdition_students_Student.cb1_POK_checkbox, Student.firstname, CourseEdition_students_Student.cb3_cohort, CourseEdition.lmsAccess, CourseEdition.Status, CourseEdition_students_Student.checkbox, (users.username IS NOT NULL) as userAccount FROM CourseEdition_students_Student INNER JOIN Student ON CourseEdition_students_Student.Student_id = Student.Student_id INNER JOIN CourseEdition ON CourseEdition_students_Student.CourseEdition_id = CourseEdition.CourseEdition_id LEFT OUTER JOIN users ON Student.Student_id = users.Student_id WHERE (CourseEdition_students_Student.CourseEdition_id='1') LIMIT 0, 75
Code:
<operationBinding requiresRole="ROLE_USER" requiresAuthentication="true" operationType="fetch" operationId="fetchSubscriptionDetail" customValueFields="students_id,editionName, attendancePercentage,startDate,published,Status,percentageOfSubscriptions,lmsAccess,firstname, tussenvoegsel,surname,voorletter,birthdate,birthplace,gender,sofinummer,street,number,number_addition,postcode,city,country,phone,cellphone,email,active,archived,Moodle_id,waitinglist,cancelled" customCriteriaFields="students_id, editionName,startDate,published,Status,percentageOfSubscriptions,lmsAccess,firstname,tussenvoegsel,surname,voorletter,birthdate,birthplace,gender, sofinummer,street,number,number_addition,postcode,city,country,phone,cellphone,email,active,archived,Moodle_id,waitinglist,cancelled, attendancePercentage" > <selectClause>$defaultSelectClause, (users.username IS NOT NULL) as userAccount</selectClause> <tableClause> CourseEdition_students_Student INNER JOIN Student ON CourseEdition_students_Student.Student_id = Student.Student_id INNER JOIN CourseEdition ON CourseEdition_students_Student.CourseEdition_id = CourseEdition.CourseEdition_id LEFT OUTER JOIN users ON Student.Student_id = users.Student_id</tableClause> </operationBinding>
Comment