13.07.2015 Views

Reports & Queries - Source : www.pcsoft-windev-webdev.com

Reports & Queries - Source : www.pcsoft-windev-webdev.com

Reports & Queries - Source : www.pcsoft-windev-webdev.com

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

15.4 Break processIf your report contains one or more breaks, the break process is associated with the Break header block.This process enables you to use a programmed break. Two types of programming can be implemented for thebreaks:• the code of the break returns True or False (True to perform the break, False not to perform the break).• the code of the break returns the value of the break. If the value changes, the break is automaticallyperformed by the report (see the example below).The value of the break can correspond to the value of an item, a report control, a variable, ...Note: If the value of the break corresponds to the value of a report control, the returned value will befalse if this control is found in the Body block of the report. Indeed, the break process is run before thecontrols found in the Body block are filled. In this case, you must return the value of the item linked tothe control.Important: The break code is run only if the corresponding break is a programmed break (not linked to a sortcriterion).See the online help (keyword: "Break in a report") for more details.15.5 Sort procedure-- Code of the breaknSupplier is int = 0// Retrieve the identifier of the suppliernSupplier = ExtractString(gfsLine, 1, TAB)// Find the name of the supplierHReadSeekFirst(SUPPLIER, SupplierNum, nSupplier)IF HFound() = True THEN// Initialize the controlSupplierName = SUPPLIER.CompanyEND// Return the identifier of the supplierRESULT nSupplierFurthermore, a sort procedure can be implemented in a report based on a data file or in a report based on amemory zone. This procedure can be used to modify the sort criteria dynamically.To implement a sort procedure:1. On the "Modification" pane, in the "Report" group, click "Edit the sorts". The list of sort criteria is displayed.2. Click the "+" button used to add a sort.3. Select "Sort on WLanguage code".4. Enter the name and value of the parameters for the sort procedure (for example: "SortVal("City")").Note: you also have the ability to use a WLanguage function directly. The "Function" button lists the WLanguagefunction that can be used directly.5. Validate the addition of the new sort criterion.6. Create the sort procedure. This procedure must return the sort argument. For example:PROCEDURE SortVal(Criterion)// Sort by NAME or by CITYSWITCH CriterionCASE "City": RESULT Customer.CityCASE "Name": RESULT Customer.NameEND138Part 1: Report editor

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!