[% BLOCK logme_block; "\n\t\n"; END; MACRO logme(a) PROCESS logme_block x = a.list.join(', '); %] [% USE CGI; USE DBI; USE WebSession; USE utils = WebUtils; USE config = XML.LibXML(config_xml); userid = 1; dir = '/reporter/setup/files/' _ stage_dir; dir = config.findvalue(dir); dbname = config.findvalue('/reporter/setup/database/name'); dbhost = config.findvalue('/reporter/setup/database/host'); d_u = config.findvalue('/reporter/setup/database/user'); d_p = config.findvalue('/reporter/setup/database/password'); dsn = "dbi:Pg:dbname=" _ dbname _';host=' _ dbhost; logme([dsn,d_u,d_p]); DBI.connect(dsn,d_u,d_p); %] [% PROCESS PRINT_STAGE1 %] [% BLOCK PRINT_STAGE1 %] [% FOR s1 IN DBI.query("select * from reporter.stage1 where pub is true;"); file = dir _ '/' _ s1.filename; USE doc = XML.LibXML(file); fact_table = doc.findvalue('//report/@fact-table'); logme(fact_table); %] [% PROCESS stage1_detail IF CGI.param('detail') == 1 %] [% END %]
Name: [%doc.findvalue('/reporter/report/@name')%]
Description: [%doc.findvalue('/reporter/report/description')%]
[% END %] [% PROCESS stage2_new IF CGI.param('create_stage2') == 1 %] [% BLOCK stage2_new; col_xpath = "/reporter/tables/table[@id='" _ fact_table _ "']/fields/field[@core='true']"; logme(col_xpath); '

Core report limiters

'; FOR col IN config.findnodes(col_xpath); logme(col.findvalue('@name')); widget = col.findvalue('@widget') or col.findvalue('@datatype'); INCLUDE "draw_$widget" column = col; END; END; %] [% BLOCK draw_timestamptz %] [% column.findvalue('label') %]

[% END %] [% BLOCK dim_description %] [% PROCESS table_fields table = dim %] [% END %] [% BLOCK table_fields %] [% FOR f IN table.findnodes('fields/field') %] [% END %] [% END %] [% BLOCK stage1_detail %] [% PROCESS table_fields table = config.findnodes("/reporter/tables/table[@id='$fact_table']") %] [% END %]
[% column.findvalue('description') %]
Report Range Size:
Name: [% dim.findvalue('name') %]
Field: [% f.findvalue('@name') %] ([% f.findvalue('@datatype') %])
Visible Stage2 reports: [% q = 'select count(*) as x from reporter.stage2 ' _ 'where pub is true or owner = ' _ userid; FOR r IN DBI.query(q); r.x; END %]
Report Attributes
(dimensions):
[% incs = doc.findnodes('//report/dims/dim/@include'); FOR dim IN incs; ''; link_xpath = '/reporter/tables/table[@id="' _ fact_table _'"]'_ '/links/link[@field="' _ dim.value() _ '"]/@table'; logme(link_xpath); dim_table = config.findvalue(link_xpath); dim_xpath = '/reporter/tables/table[@id="' _ dim_table _'"]'; logme(dim_xpath); dim_def = config.findnodes(dim_xpath); PROCESS dim_description dim = dim_def; '
'; END %]