ci-server-engineer/examples/CI-Eng-Sample/18_report_df.qli
cliu 0bff3698c2 Record the Engineering Module check of the phase 11 reports
User checked the report forms, the generate dialog and viewing text and
HTML reports. The [ITEM:...] prompt filter does not limit the item
browser (ISS-048). system-check: Stop-Service error while CI Server
still restarts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 16:47:49 +10:00

82 lines
3.3 KiB
Text

@LANGUAGE
ENGLISH
@VERSION
1.03.00
! CI-Eng-Sample reports (REPORT_DF), CI Server R1.03.00. Load after 17_printer_df (destination).
! Each report gets a storage group of type Report with the same name (lifetime = LIFE_TIME,
! rollover = GENERATION_INTERVAL, so a schedule must be at least 10 minutes).
! Report names: at most 16 characters.
!
! CIENG_TANK1 : values of all TANK1 items plus last-hour statistics of one item (parameter
! @p0, chosen in an item browser; its filter does not limit it, ISS-048); daily at 06:00.
! The activation time lies in the past; CI Server moves it to the next 06:00.
! CORRECT_DAYLIGHT 1 keeps 06:00 across daylight-saving changes (with 0 the
! interval runs in UTC and 06:00 in January became 05:00 in October).
! CIENG_INFLOW_HI: generated 5 s after TANK1.INFLOW rises above 400 (only when the condition
! becomes true, not again while it stays above).
! CIENG_HTML : HTML output (CONTAINS_HTML is set automatically), cursor loop, logbook text.
@FIELDS
NAME,DESCRIPTION,PRIORITY,ADHOC_ENABLED,LOGBOOK_ENABLED,LIFE_TIME,ACTIVATION_TIME,GENERATION_INTERVAL,CORRECT_DAYLIGHT,DEST_NAME,ADHOC_DEST,PARAM_PROMPT_1,QUERY
@REPORT_DF
"CIENG_TANK1","CI-Eng-Sample tank 1 values",0,1,1,"1 Weeks","01-01-2026 06:00:00","1 Days",1,"CIENG_FILE","CIENG_FILE","[ITEM:NAME like ""CI-Eng-Sample.TANK1.*""]Item for statistics:",\
@"
/* CI-Eng-Sample: current values of tank 1, then last-hour statistics of one item */
column v as '9999.9' heading 'Value';
select name, item_value v, status from item_val where name like 'CI-Eng-Sample.TANK1.%';
select '';
if @p0 = '' then
set @item 'CI-Eng-Sample.TANK1.LEVEL';
else
set @item @p0;
endif;
select 'Last hour: ' || @item;
column n heading 'Samples';
column mi as '9999.9' heading 'Min';
column ma as '9999.9' heading 'Max';
column av as '9999.9' heading 'Average';
select count(item_value) n, min(item_value) mi, max(item_value) ma, avg(item_value) av
from item_history where item_name = @item and sample_time > @date - 3600;
"@
@FIELDS
NAME,DESCRIPTION,PRIORITY,ADHOC_ENABLED,LIFE_TIME,TRIGGER_ITEM,TRIGGER_CON_1,TRIGGER_VAL_1,DELAY,DEST_NAME,ADHOC_DEST,QUERY
@REPORT_DF
"CIENG_INFLOW_HI","CI-Eng-Sample tank 1 inflow above 400",0,1,"1 Weeks","CI-Eng-Sample.TANK1.INFLOW","Greater Than",400,"5 Seconds","CIENG_FILE","CIENG_FILE",\
@"
column t as 'DD-MMM-YYYY hh:mm:ss';
select 'Tank 1 inflow high: ' || char(gpv_value('CI-Eng-Sample.TANK1.INFLOW', 0), '%.1f') || ' m3/h at', @date t;
"@
@FIELDS
NAME,DESCRIPTION,PRIORITY,ADHOC_ENABLED,LOGBOOK_ENABLED,LIFE_TIME,ADHOC_DEST,LOGBOOK,QUERY
@REPORT_DF
"CIENG_HTML","CI-Eng-Sample tank 1 as HTML",0,1,1,"1 Weeks","CIENG_FILE",@"
Sample logbook text
"@,\
@"
/* HTML output: no header/footer, no page breaks */
header '';
footer '';
set @page_size 0;
set @width 512;
select '<HTML><BODY><H3>CI-Eng-Sample tank 1</H3><TABLE BORDER=1>';
set @n '';
set @v 0.;
declare @c is select name, item_value from item_val where name like 'CI-Eng-Sample.TANK1.%';
open @c;
loop
fetch @c into @n, @v;
if @rqlcount = 0 then
exit;
endif;
select '<TR><TD>' || @n || '</TD><TD>' || char(@v, '%.1f') || '</TD></TR>';
endloop;
close @c;
declare;
select '</TABLE><P>Logbook: ' || logbook_text('CIENG_HTML') || '</P></BODY></HTML>';
"@