Subject Re: snake report addition
From Mervyn Bick <invalid@invalid.invalid>
Date Wed, 30 Nov 2016 07:55:03 +0200
Newsgroups dbase.getting-started

On 2016-11-30 12:16 AM, Charlie wrote:
> Hi Mervyn..
>
> OK I understand what you are doing with the temp dbf now.  (Have never done this before but now understand the concept.)
>
> I copied the code between the astericks  and the end header.
>
> The table's name is golfers_scores so I changed snake to golfers_scores in each instance.
>
> On this line I get an error:  Invalid field name...
>
> insert into temp_golfers_scores (data1,late_entry) values ('99',true)
>
> Have never done this before so I have no clue!!!
>
> If I get this resolved is this the only little bit of code I have to add between the astericks and the end header??  Anything else have to be changed?
>
> Thanks much!!


Your report would normally use one group object.  The group1 header band
prints the match number and then the detailband prints the names.  When
the match number changes the headerband prints the next match number and
so on and so on until the end of the table.

Because of a bug, dBASE doesn't immediately respect a beginNewframe set
by a footerband or a detailband preRender event handler.  It does,
however, respond immediately to a beginNewframe set by a headerband
event handler.

To get round the bug I added a second group.  The two groups are nested
and as it is the outside group it will be group1. The group you would
normally use to separate the matches becomes group2.

The trouble with this approach is that the new group needs a change in
the contents of a field to force a new group headerband.  There isn't a
suitable field in your existing table so this means adding a field.  As
it is not a good idea to add this to the original table we needa
temporary table.

The code at the top of the report  copies the main table to a temporary
table, adds a logical field to each record and sets all the contents of
all the new fields to false.  To force a new group a dummy record is
added to the end of the table with the new field set to true.  The match
number, which the main group uses, is set to a value that won't clash
with an actual match number.  I've used '99' and in the report I test
for this number and prevent it printing on the group2 headerband.

In the example report I used "data" as the field for the name and
"data1" as the match number.  You will need to use the names of the
fields in your table. Something like

     insert into temp_golf_scores (match_no,late_entry) values ('99',true)

Use the correct field name and if the field for the match no is numeric
then ...values(99,true).  If the field is numeric you will need to
change the test in the two canRender event handlers as well.


The example is just that.  It is meant to show you the techniques needed
to produce the report. If you want to use it with your own table you
will need to go through it and change all references to "data" to the
field that holds your names and all references to "data1" to the field
that holds your match numbers.  You will also need to change the sql
property of your query.

Mervyn.