def populate(list_ctrl, sql): selected_id = selectedItemID(list_ctrl) reselectIndex = selectedItemIndex(list_ctrl) res = fetch.getAll_col(sql) # 1st col must be 'id' if res: populateWithList(list_ctrl, res, selected_id) list_ctrl.Select(reselectIndex) list_ctrl.SetFocus()
def loadStudentPool(self): school_id = fetch.schoolID_forExculSet(self.exculset_id) return self.exculList = fetch.excul_groups_forExculSet(self.exculset_id) exculID_list = ','.join([str(x[0]) for x in self.exculList]) sql = "SELECT student_id FROM excul_students WHERE FIND_IN_SET(excul_id , '%s') " % exculID_list res = fetch.getAll_col(sql) in_excul_list = ','.join([str(x[0]) for x in res]) sql ="SELECT s.id, s.first_name, b.name \ FROM students s \ LEFT JOIN nis n ON s.id = n.student_id \ JOIN batch_students bs ON s.id = bs.student_id \ JOIN batches b ON b.id = bs.batch_id \ WHERE %d BETWEEN n.admission_year AND n.withdrew_year\ AND n.school_id = %d \ AND NOT FIND_IN_SET(s.id, '%s') \ GROUP BY s.id \ ORDER BY s.id \ LIMIT 90" % (gVar.schYr, school_id, in_excul_list) lv.populate(self.list_ctrl_pool, sql)