Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to make an Index
Message
De
21/03/2002 10:08:05
 
 
À
21/03/2002 07:58:18
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Divers
Thread ID:
00635422
Message ID:
00635487
Vues:
13
Petros,

You could create a table of contents by calling a UDF from the following reporting events:
Title.OnEntry( TOC("Init") )
GroupHeader.OnEntry( TOC("From", _PAGENO, GroupCaption) )
GroupFooter.OnExit( TOC("To", _PAGENO) )
The User Defined Function TOC() creates a cursor and updates the cursor with the caption and page numbers. This concept could be enhanced to support different levels of groups, etc.

Printing the TOC on the last page is a bit tricky because VFP doesn't allow the stretch option in the summary band. You could add a field to the summary band and size it to fill the page. Enter the following expression:
TOC("GetToc")
Use a non-proportional font for the field. Alternatively, you could create a separate report that prints a table of contents and call this report. This would give much more flexibility over the layout.

Hope this helps

Here's the code for TOC:
*) Program...........: TOC.PRG
*  Author............: Daniel Gramunt
*  Created...........: 07.02.2001 - 15:02:39
*) Description.......: Creates a table of contents for a report.
*  Calling Samples...:
*  Parameter List....:
*  Major change list.:
*--------------------------------------------------------------------------------------------------
LPARAMETER tcAction, tnPageNo, tcGroupCaption

ASSERT VARTYPE(tcAction) = "C" AND;
       INLIST(UPPER(tcAction), "INIT", "FROM", "TO", "GETTOC");
       MESSAGE "Parameter < tcAction > : Parameter missing or invalid value"+;
               "(Expecting 'INIT', 'FROM', 'TO' or 'GETTOC')"

LOCAL lcAction, lnSelect, lcRetVal, lcClipText

lcAction = UPPER(tcAction)
lnSelect = SELECT()
lcRetVal = ""

DO CASE
   CASE lcAction = "INIT"
      *-- Initialize TOC (create the TOC cursor)
      *-- Called from the report's title.onEntry( TOC("Init") )
      CREATE CURSOR TOC (Group C(50), From N(3), To N(3))
   CASE lcAction = "FROM"
      *-- New group. Add group and starting pageno to TOC
      *-- called from the report's groupHeader.onEntry( TOC("From", _PAGENO, GroupExpression) )
      INSERT INTO TOC VALUES(tcGroupCaption, tnPageNo, 0)
   CASE lcAction = "TO"
      *-- EOF group. Update TOC with ending pageno
      *-- called from the report's groupFooter.onExit( TOC("To", _PAGENO) )
      REPLACE toc.To WITH tnPageNo IN toc
   CASE lcAction = "GETTOC"
      *-- Get TOC into a memvar
      *-- called from the report's summary field ( TOC("GETTOC") )
      lcClipText = _CLIPTEXT
      GO TOP IN TOC
      _vfp.DataToClip("TOC",,1)
      lcRetVal = _CLIPTEXT
      _CLIPTEXT = lcClipText
ENDCASE

SELECT (lnSelect)
RETURN lcRetVal
>Hi all
>
>I have a file called PRODUCTS.DBF and is ordered by Category. On the report (.frx) I have a data group : CATEGORY.
>
>There is any way to make an index at the end of the report for example :
>
>
>CATEGORY PAGE(FROM-TO)
>===============================
>DTR 1-20
>SOF 21-30
>JUI 31-46
>DET 47-76
>.....
>....
>
>Is any way to take the _pageno variable when report group is changing ?
>
>Thanks in advance
>Petros
Daniel
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform