Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
****************************************************
* Program to modify table for certain type of report
****************************************************
LinesPerPage = 20 && must be set according to actual design of report
&& "primary" sorting and adding
&& a temporary new field to original table
&& invisible in report but serving for grouping
SELECT NameField, OtherField, left(NameField,1) AS TmpField ;
FROM MyTable ;
ORDER BY TmpField, NameField ;
INTO CURSOR tmp
COPY TO tmp1 && cursor isn't updatable
GO TOP && pointer is bottom after a copy
DO WHILE NOT EOF() && examine all records
lnCounter = 0 && clear counter for every letter
lcTmpField = TmpField && now only recs with this letter
DO WHILE TmpField = lcTmpField
lnCounter = lnCounter + 1 && count them
SKIP
ENDDO
&& add "blank" recs, but only when needed
IF MOD(lnCounter,LinesPerPage) <> 0
FOR n = 1 TO LinesPerPage - MOD(lnCounter,LinesPerPage)
INSERT INTO tmp1 (TmpField) VALUES (lcTmpField)
ENDFOR
ENDIF
ENDDO
&& orig. tmp not needed any more,
&& so can use it again
SELECT namefield, otherfield, tmpfield ;
FROM tmp1 ;
ORDER BY tmpfield ;
INTO CURSOR tmp
REPORT FORM MyForm NOCONSOLE PREVIEW && that's it