Table of Content
HAL Forum
Part 1: Write a report
A HAL report consists of three different parts of code. The fist part is the startup section that is executed when Hansa is started, the second part is the Report Specification window that allows the user to specify how to run the report and the third part is the procedure that calculates that output of the report and displays it. Here is the code of a report skeleton showing the minimum code of a report. We will go through all the sections one by one below.


event startup
begin
  SetLangMode(LangEnglish,"ENG",0);
  Report("Empty Report",EmptyRClass,EmptyRn,0,modTC);
end;

event DefineWindows
begin
  real x,h,h1,h2,h3,h4,h5,h6,h7,v,v2,l,vs,vm,f,t;
  SetLangMode(LangEnglish,"ENG",0);
  WindowBegin("Specify My Own Report ",EmptyRClass,CGRcW,RcType);
  SetWRect(5,73,415,250);
  v = 6; vs = 20; h = 120;
  EndWindow;
end;

global
procedure EmptyRn(record RcVc RepSpec)
begin
  /* Declare Variables */

  /* Initialize all Variables */

  /* Start the Job */

  StartReportJob("Empty Report");

  /* Print the Header */

  EndHeader

  /* Start the Loop */

  /* Test to see if the Loop should break */

  /* Test to see if the found record should be skipped */

  /* Print out the information */

  /* Add up the Totals */

  /* End of the Loop, the program returns to the LoopBegin */

  /* Print the Totals */

  /* End the Report */

  EndJob;
  return;
end;



Fist of all, let´s replace "Empty" with "MyFirst" (no space between My and First) in the code and then save it in the halcust folder as MyFirstReport.hal.