~[tlist_sql; select max(attendance.dcid) from attendance where attendance.att_mode_code = 'ATT_Mode~(gpv.attType)' and attendance.att_date = to_date('~(gpv.att_date)', 'YYYY-MM-DD') ~[if#studentid.~(gpv.studentid)#] and attendance.studentid = '~(gpv.studentid)' [/if#studentid] ~[if#attendancedcid.~(gpv.attendancedcid)#] and attendance.dcid = '~(gpv.attendancedcid)' [else#attendancedcid] ~[if#ccid.~(gpv.ccid)#] and attendance.ccid = '~(gpv.ccid)' [/if#ccid] [/if#attendancedcid] ;] ~[if#printTardySlip.gpv.printTardySlip=1] [/if#printTardySlip] ~[if#dailyException.gpv.dailyException=1] [/if#dailyException] [/tlist_sql]