我遇到了在数据未按应有方式提取的站点上运行的报告的问题。具体来说,有带有 tlist、From 和 To 日期、Student 和 Sports 的下拉设置。该问题与 Sports 下拉菜单或输出有关。
下拉菜单
<select id="lt" name="lt">
<option value="-1" selected="selected">All Sports</option>
~[tlist_sql;
SELECT DISTINCT log.logtypeid,
CASE WHEN log.subtype is null THEN ' ' ELSE log.subtype END subID,
CASE WHEN ','||'~[gpv:lt]'||',' LIKE '%,' || log.subtype || '.' || CASE WHEN
log.subtype is null THEN ' ' ELSE log.subtype END || ',%' THEN 'selected' ELSE '' END isselected,
lt.Name logtype,
CASE WHEN to_char(st.ValueT) is null THEN ' - NONE' ELSE ' - ' || to_char(st.ValueT) END subtype
FROM log
INNER JOIN gen lt ON log.logtypeid = lt.id
LEFT OUTER JOIN gen st ON st.Name = to_char(lt.ID)
AND st.value = log.subtype
AND st.Cat = 'subtype'
WHERE lt.Cat = 'logtype'
AND log.logtypeid = '3935'
AND to_char(log.schoolid) like CASE WHEN ~(curschoolid) = 0 THEN '%' ELSE to_char(~(curschoolid)) END
ORDER BY subtype
;]
<option value="~(logID;l).~(subtypeID;t)" ~(isselected;t)>~(LogType;t)~ (SubType;t)</option>
[/tlist_sql]
输出
~[tlist_sql;
SELECT s.Student_Number, s.grade_level, s.lastfirst student, to_char(st.ValueT) subtype, log.discipline_weapontype,
CASE WHEN log.discipline_hearingofficerflag = '1' THEN 'Yes' ELSE ' ' END as pp,
CASE WHEN log.discipline_weaponrelatedflag = '1' THEN 'Yes' ELSE ' ' END as ss,
DBMS_LOB.SUBSTR(log.entry, 4000,1) Notes
FROM log
INNER JOIN students s ON log.studentid = s.id
~[if#cursel.~[gpv:studentID]=cur]INNER JOIN ~[temp.table.current.selection:students] temp ON temp.dcid=s.dcid[/if#cursel]
INNER JOIN gen lt ON log.logtypeid = lt.id
LEFT OUTER JOIN gen st ON st.Name = to_char(lt.ID)
AND st.value = log.subtype
AND st.Cat = 'subtype'
AND lt.Cat = 'logtype'
WHERE studentid IN
(SELECT studentid
FROM log
WHERE subtype IN
(SELECT subtype
FROM log
WHERE logtypeid = '3935'))
AND subtype IN ('29','43','100','101','102','104','105','106','107','109','110','111','112','113','114','115','116','117','119','120','121','122','123','125','126','127','128','129','130','131','132','133')
AND log.entry_date >= to_date('~[gpv:dateselect]','MM/DD/YYYY')
AND log.entry_date <= to_date('~[gpv:dateselect2]','MM/DD/YYYY')
AND
~[if#cursel.~[gpv:studentID]#cur]
to_char(s.ID) LIKE CASE WHEN '~[gpv:studentID]' = '-1' THEN '%' ELSE '~[gpv:studentID]' END
[/if#cursel]
AND (
(','||to_char('~[gpv:lt]')||',' LIKE '%,' || to_char(log.logtypeid) || '.' || CASE WHEN log.subtype is null THEN ' ' ELSE log.subtype END || ',%')
OR (','||to_char('~[gpv:lt]')||',' LIKE '%,' || to_char(log.logtypeid) || '.-1,%')
OR (to_char(log.logtypeid) LIKE CASE WHEN to_char('~[gpv:lt]') = '-1' THEN '%' ELSE ','||to_char('~[gpv:lt]')||',' END)
)
ORDER BY s.lastfirst, log.entry_date;alternatecolor]
<tr class="oddRow">
<td>~(count;-)</td>
<td name="stNumCol">~(stNum;t)</td>
<td name="gradeCol">~(grade;t)</td>
<td name="studentCol">~(Student;t)</td>
<td name="subtypeCol">~(st;t)</td>
<td name="dopCol">~(date of physical;t) </td>
<td name="ppCol">~(parent perm.;t) </td>
<td name="ssCol">~(student signa.;t)</td>
<td name="notesCol">~(notes;t)</td>
</tr>
[/tlist_sql]
当报告在选择所有运动的情况下运行时,它会拉出所有拥有运动日志的学生
log.logtypeid = '3935'
或者他们也可以是
log.subtype IN ('100','101','102','104','105','106','107','109','110','111','112','113','114','115','116','117','119','120','121','122','123','125','126','127','128','129','130','131','132','133')
需要提取另一组数据,子类型“29”和“43”,它们是健康日志。29 代码使某人无法参加一项运动,而 43 则使他们能够。
问题
运行所有运动时,它会显示所有学生的运动日志,并且还会显示学生 29 和 43 的代码。但是从下拉列表中选择单个运动时,它不会显示那些学生的 29 和 43 健康日志子类型。
任何意见或建议将不胜感激。谢谢