Hi all,
As I told, I am starting on EGL, and of course, having some problems. I am using RBD EGL 9.5.0.1
I have a TXT file (is a report saved in TXT format) and I need to print this file directly to printer (not using BIRT or JASPER - report generator).
I created a Resource Association, with a record of 132 char (that is my entire report line), so I need read my TXT file, and print.
Follow my examples:
- my report print program
package Reports;
import reports.CSVRelatorioRecord;
import reports.textReportHandler;
program RelReport type BasicProgram {}
RelatorioRec CSVRelatorioRecord;
myHandler textReportHandler{};
function main()
myHandler.start(); // passes control to handler
/* follow where I am having problem, I don't know how to get the record from a TEXT file and Print */
get next RelatorioRec; // I am having a error when I DEBUG the program
while (RelatorioRec not endOfFile)
myHandler.outputRel(RelatorioRec.Linha_Relatorio);
get next RelatorioRec;
end
myHandler.finish(); // close report
end
end
- my Record as follow
package Reports;
// basic record
//
record CSVRelatorioRecord type CSVRecord
{
fileName = "Relatorio",
delimiter = ";",
textQualifier = "\"",
style = CsvStyle.quoted
}
Linha_Relatorio char(132);
end
- my Handler as follow
package Reports;
import reports.prtRecord;
handler textReportHandler type BasicHandler
myReport TextReport{}; // creates instance
currentReportRecord prtRecord;
runningTotal MONEY = 0;
function start()
myReport.onEveryRowListener = onEveryRow;
myReport.onLastRowListener = onLastRow;
// accept defaults on everything but destination file
myReport.startReport("c:/temp/customerReport.txt",null,null,null,null,null,null);
end
function outputRel(cLinha STRING in)
// this information comes from the forEach loop in the main program
currentReportRecord.prtPrograma = cLinha;
// pass control to the report engine
// onEveryRow is called
myReport.outputToReport();
end
function output(cName STRING in, cIP STRING in)
// this information comes from the forEach loop in the main program
currentReportRecord.prtPrograma = cName;
currentReportRecord.prtEND_IP = cIP;
// runningTotal = runningTotal + cIP;
// pass control to the report engine
// onEveryRow is called
myReport.outputToReport();
end
function finish()
// pass control to the report engine again
// onLastRow is called
myReport.finishReport();
end
function onEveryRow(myEvent TextReportEvent in)
myReport.printText(currentReportRecord.prtPrograma);
myReport.column(40);
myReport.printText(currentReportRecord.prtEND_IP);
myReport.println();
end
function onLastRow(myEvent TextReportEvent in)
myReport.println(); // skip a line
myReport.printText("All customers:");
myReport.column(40);
myReport.printText(runningTotal);
end
end
- my ressource association in attach
neidossantos