Procedure Types

Procedures are used to format specific segments of data. The contents of a procedure are enclosed in brackets and include formatting statements; to identify data and call other procedures.

There are several types of procedures, some are for formatting Planner lists and some are specific to generating reports.

Section Type and Number

Used for Planner list formatting files. A combination of the section type and section number.

Example:

procedure op_1030000
{
   // Formatting commands for this procedure
}

Section Type

Same idea as Section Type and Number, except that you only need provide the Section Number. This style is used in Report format files.

Example:

//  Milling Operations (all)
procedure section_1030100
{
   // Add commands needed for the Step information
}

Defined Procedures

Procedures not based on Section Numbers, defined by the user. Often used a procedural wrappers around map statements. Or to handle outputting of commonly used formatting commands. User Defined Procedures are run when they are called. The statement, call(procedure name) is used to run the procedures.

User defined procedures are used in both Planner list and Report format files.

//  Procedure to map unspmode data tag to a text string
procedure speed_mode
{
   format("%s",
      map(unspmode, [1 = "SFM", 2 = "RPM", 11 = "m/min", 12 = "RPM"]));
}

Init Procedure

An optional procedure which is called once when generating a report. It is the first procedure run and is used to initialize report parameters; such as page width and length, whether or not to use pagination, and whether to end the report with a form feed (^L) to force the page out of the printer.

Only for JOS Reports. Example:

//  Initialization procedure
// Turn off pagination and set page width large enough to contain the
// longest unbreakable line in the exported HTML code
procedure init
{
	page_width(256);
	disable_pagination();
	disable_form_feed();
	html_encode();
}

Header Procedure

Formats the heading, which appears at the top of every page of a report. If not included in your format files, no header is printed on the report.

If the disable_pagination() function is used, then the header procedure is only called once, when the report is started.

Only for JOS Reports. The following is an excerpt from the default HTML report format. It establishes required HTML content needed to display an HTML report.

//  Main HTML report HEADER procedure
procedure header
{
   format("<!DOCTYPE HTML>\n");
   format("<html>\n\t<head>\n\t\t<title>SmartCAM HTML Job Report</title>\n");
   format("\t\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n");
   format("\t\t<link href=\"./reports_scrn.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\">\n");
   format("\t\t<link href=\"./reports_prnt.css\" media=\"print\" rel=\"stylesheet\" type=\"text/css\">\n");
   format("\t</head>\n\<<body>\n");
}

Footer Procedure

Formats the footer, which appears at the bottom of every page of a report. If this procedure is not included in your format files, then no footer is printed.

If the disable_pagination() function is used, then the footer procedure is only called once, when the report is complete.

Only for JOS Reports. The following is an excerpt from the default HTML report format.

//	Main HTML report Footer procedure
procedure footer
{
   //	output the HTML report closing footer table
   format("\t\t<table class=\"footer\">\n");
   format("\t\t\t<tr class=\"footer\">\n");
   format("\t\t\t\t<td class=\"footer\"><center> %d SmartCAMcnc. All Rights Reserved.</center></code><td>\n", year());
   format("\t\t\t</tr>\n\t\t</table>\n");
   format("\t</body>\n</html>\n");
}

Job Info Header and Footer Procedures

Like the header and footer procedures; these two procedures run once at the start and end of a report. However, these procedures bookend the Job Info report. If the Job Info report option is selected the job_header procedure is run just before generating the Job Info report section. And the job_footer procedure is run right after the Job Info information is created.

Only for JOS Reports. The following are excerpts from the default Turning HTML report format.

//	Create the initial Job Report table - this establishes the table
procedure job_header
{
   format("\t\t<table class=\"jobreport\">\n");

   //	report table banner row
   format("\t\t\t<tr class=\"jobreport\">\n");
   format("\t\t\t\t<th class=\"jobreport\" colspan=6><H2>Job Report</H2></th>\n");
   format("\t\t\t</tr>\n");
}

//	Close out the Job Report table - add footer row if needed
procedure job_footer
{
   format("\t\t</table>\n");
}

Step Report Header and Footer Procedures

Like the Job Info Header/Footer, these header and footer procedures run at the start and end of the Step Report. When the Steps report content option is enabled, these procedures are used.

Only for JOS Reports.

//  Create the Step Report section header 
procedure step_header
{
   ... Add your format statement information here
}

// Create the Step Report section footer 
procedure step_footer 
{
   ... Add your format statement information header 
}

Tool Report Header and Footer Procedures

Like the Job Info Header/Footer, these header and footer procedures run at the start and end of the Tooling Report. When the Tooling report content option is enabled, these procedures are used.

Only for JOS Reports.

//  Create the Tool Report section header 
procedure tool_header
{
   ... Add your format statement information here
}

// Create the Tool Report section footer 
procedure tool_footer 
{
   ... Add your format statement information header 
}

Related Topics

Customizing Format Files

Format Language

Format Statement

Data Tags and Section Numbers

Section Numbers

About Reports

Customizing SmartCAM Reports