Subject Re: EQ of XBase TOTAL Command
From Mervyn Bick <invalid@invalid.invalid>
Date Thu, 10 Aug 2017 08:30:33 +0200
Newsgroups dbase.getting-started

On 2017-08-09 8:50 PM, Mustansir Ghor wrote:
> Dear Mervyn
> Thank you. An eye opener for a programmer like me. Great programming. Three issues that has come as curiosity.
> 1. In the tabbar when report is on screen. if we click any of the pushbutton it does not respond until report is closed. How this is controlled.

I honestly have no idea.  This is coming from dBASE, not from my code.

> 2. In the new query in report file , the database = form.form.database1. Why there are 2 form.form

This is code streamed out by the report designer so this is an anomaly
in the designer itself.  Strictly speaking it shouldn't work as a form
object doesn't have a form property.  Although it looks peculiar it
works so it's not really a bug. :-)  dBASE only needs 1 form there so
you can actually delete one of them without causing a problem.

> 3. In the sql string there is group by  p.description,oi.partID. But these two columns represent same information. if it were because of sorting then why not use  order by.

Where aggregating functions such as sum() and count() are used in a
SELECT statement together with regular fields all such fields must be
included in the GROUP BY clause.  This is a SQL requirement.  The
resulting rowset is ordered as if the fields in the GROUP BY clause were
in an ORDER BY clause.

Both the description and the part number are included in the rowset
because I wanted to be able to produce a numerical order and an
alphabetical order.

The two SELECT statements are essentially the same except for the GROUP
BY clauses.  For the numerically ordered SELECT statement I could just
as easily have used the alphabetically ordered SELECT statement and
added an ORDER BY clause

form.sql_n +='group by p.description,oi.partID order by oi.partId'

This would, however, have meant extra work "behind the scenes".  The
rowset would have been genrated in alphabetical order and then it would
have had to be re-sorted into numerical order.  By changing the order of
the fields in the GROUP BY clause the rowset is in teh correct orer to
start with.

> Thanks once again.
> May be this is the right for me to request to you to enlighten us to develop menubar to be used with _app.framewin. In earlier correspondence Ken sir established that code used in his tutorial does not work and crashes.

I learnt a lot of what I know of dBASE from Ken and I still refer to his
books when I get stuck.  If he can't get it right I'm afraid there's not
much chance that I can do better.  :-)