In OnDefaultRequest event of the ISAPIDispatcher1 module we generate a form that allows the user to insert the start and end dates of the report, the relevant EDIT INPUTS being FROM_DATE and TO_DATE, and the group length parameter LENGTH. As the start and end dates are required for compiling all groups, the ReportParams of the same name are used later to recurrent use of these parameters within the client's request.
Both the first form and the group form send grform requests, which we process in the OnAction event of the ISAPIActionItem1 where we generate a corresponding SQL request for the FROM_DATE and TO_DATE parameters, and in the case there is a input parameter LENGTH, we use it to manage the length of the group.
NB! In fmResult module the FReport1 DataSource property is DSR. This is necessary for the grouping to function even if the URL path does not include any information regarding DataSource. If URL is created by clicking on GroupManager buttons, then the URL will include all the necessary information.
Form fmResult has the FRGroupManager1 component that is linked to the TFRDataSource component DSR. The FRGroupManager1, in turn, contains buttons FBT, PRBT, GRBT, NXBT, LSBT that are linked to FRGroupManager1 properties First, Prior, Group, Next, Last. The components First, Prior, Next, Last (FBT, PRBT, NXBT, LSBT in the given example) are added to the generated HTML document once, whereas their DISABLED value is set automatically. The Group component (the GRBT button in the given example) is repeated once for each possible group in the HTML document that is being generated, whereas during the generation of the corresponding part of the HTML document, the numbers of the first and the last record of the relevant group are available through the GroupBegin and GroupEnd properties of the TFRGroupManager. These properties are used to create the button caption in GRBT OnGetValue event. The numbers of the first and the last record of the group actually included in the HTML document currently being generated are available through the GroupBegin and GroupEnd properties of the TFRDataSource. These properties are used to create the label text in the lbCurrGroup OnGetText event. The total number of records corresponding to the request is available through the RecordCount property of the TFRDataSource. This property is used in lbTotal OnGetText event.
As it is necessary to know the request parameters in order to create a new group HTML, the FROM_DATE and TO_DATE parameters have been specified in the FReport1 ReportParams property on the fmResult form, and the form also contains corresponding FRHidden components. Thus, the request parameters are available in case of repeated access.
NB! As the GroupManager uses the sumbit() method of the HTML FORM element and HTML elements of INPUT type are used to forward the repeated request parameters, therefore, if used, the GroupManager should be located on the TFRForm component.