Examples: Report_Begin()


This procedure script creates a Quick Report that lists all of the current sellers in Seller_Data file of the Real Estate Sales Manager sample application. The procedure is called to run in the background.

local boolean result, print_to_screen, print_to_printer;
local string filename;
local integer font, font_size, font_style;
local integer page_height, page_width, lines_per_page, current_line;

{Is a report running? If yes, don't start the Quick Report.}
repeat
	result = Report_ReadyToRun();
until result = true;

{Specify where to direct the report. Print it to only the screen.}
print_to_screen = true;
print_to_printer = false;
filename = "";

{Begin the quick report.}
result = Report_Begin(print_to_screen, print_to_printer, filename);

if result = false then
	{Report was started successfully.}
	{Get the printable page size.}
	result = Report_GetPageSize(page_width, page_height);

	{Print a report header on the first page.}
	{Specify the font characteristics.}
	font = FONT_HELVETICA;
	font_size = 18; {18 point}
	font_style = FONT_STYLE_BOLD;
	result = Report_SetFont(font, font_size, font_style);

	{Write the header}
	result = Report_NewBand(30);
	result = Report_WriteText(0,0, page_width, 20, ALIGN_CENTER, "Current Sellers");

	{Add a double line to the header}
	result = Report_DoubleLine(0, 21, page_width);

	{Print the seller records.}
	{Specify the font characteristics.}
	font = FONT_HELVETICA;
	font_size = 12; {12 point}
	font_style = FONT_STYLE_PLAIN;
	result = Report_SetFont(font, font_size, font_style);
	{Calculate the number of lines of text per page.}
	lines_per_page = page_height / 16; {Each line is 16 points.}

	{Have already used three lines for the header.}
	current_line = 3;

	get first table Seller_Data;
	while err() <> EOF do
		{Is the current page full?}
		if current_line > lines_per_page then
			{Create a new page.}
			result = Report_NewPage();
			current_line = 1;
		end if;
	
		{Create a new band for the seller information.}
		result = Report_NewBand(16);
		result = Report_WriteText(0, 0, page_width, 14, ALIGN_LEFT, 'Seller First Name' of table Seller_Data +  " " + 'Seller Last Name' of table Seller_Data);
	
		{Increment the line count.}
		increment current_line;
	
		{Read the next seller record.}
		get next table Seller_Data;
	end while;

	{Finish the Quick Report.}
	result = Report_End();
else
	{The report wasn't run.}
	warning "Report not started.";
end if;


Documentation Feedback