Today I'd like to say a few words about packDesign()/unpackDesign() methods.
As a matter of fact we may store report design just in database. All we need is new container field in table where report design is storing.
Following job demonstrates storing technique.
When restore is false - we store the design. Else design restoring.
P.S. FieldReportDesign field should be Container.
static void JobReportDesign(Args _args)
{ Report report = new Report(); ReportRun reportRun; ReportDesign reportDesign; ReportSection reportSection; ReportTextControl reportTextControl; Table1 Table1; // boolean restore = true; boolean restore = false; BinData binData; void runReport(ReportRun _reportRun) { ReportDesign _reportDesign = _reportRun.report().design(); int sCount = _reportDesign.sectionCount(); int i; ; for(i=1; i<=sCount; i++) { _reportDesign.section(i).executeSection(); } } ; reportDesign = report.addDesign(); reportRun = new ReportRun(report); // ReStore the report --> if(restore) { select Table1 where Table1.ItemId == '000000000001'; reportRun.unpackDesign(Table1.FieldReportDesign); runReport(reportRun); report.interactive(false); reportRun.run(); return; } // ReStore the report <-- reportSection = reportDesign.addProgrammableSection(1); reportTextControl = reportSection.addTextControl('Small'); reportTextControl.width100mmInclBorder(20120); reportTextControl.fontSize(15); reportTextControl.bold(10); reportTextControl.alignment(3); reportSection.executeSection(); reportSection = reportDesign.addProgrammableSection(2); reportTextControl = reportSection.addTextControl('report'); reportTextControl.width100mmInclBorder(20120); reportTextControl.fontSize(15); reportTextControl.bold(10); reportTextControl.alignment(3); reportSection.executeSection(); report.interactive(false); // Store the report --> if(!restore) { ttsbegin; select forupdate Table1 where Table1.ItemId == '000000000001'; Table1.FieldReportDesign = reportRun.packDesign(); Table1.update(); ttscommit; } // Store the report <-- reportRun.run(); }
Copyright © 2008 Ruslan Goncharov