I think there is a bug in TOTAL command when there is a field rule expression.

Am i doing something wrong

Greg


See the code below:-

CREATE DATABASE testdbc
lcproc="PROCEDURE mydate_valid"+CHR(13)+"RETURN .T."
STRTOFILE(lcproc,'myproc.txt')
APPEND PROCEDURES FROM myproc.txt

CREATE TABLE testdbf (mydate D CHECK mydate_valid(),myinteger i)
APPEND BLANK
USE


USE testdbf
TOTAL ON mydate TO testtotal
USE


REMOVE TABLE testdbf
CLOSE DATABASES
DELETE FILE testdbc.*

Re: Expression Evaluator Failed in TOTAL ON command by Fred

Fred
Wed Oct 12 10:50:50 CDT 2005

You can't TOTAL a date field. Try doing TOTAL ON myinteger TO testtotal

--
Fred
Microsoft Visual FoxPro MVP


"Greg" <Greg@discussions.microsoft.com> wrote in message
news:0897810E-FF2E-4842-9221-F20852128063@microsoft.com...
>I think there is a bug in TOTAL command when there is a field rule
>expression.
>
> Am i doing something wrong
>
> Greg
>
>
> See the code below:-
>
> CREATE DATABASE testdbc
> lcproc="PROCEDURE mydate_valid"+CHR(13)+"RETURN .T."
> STRTOFILE(lcproc,'myproc.txt')
> APPEND PROCEDURES FROM myproc.txt
>
> CREATE TABLE testdbf (mydate D CHECK mydate_valid(),myinteger i)
> APPEND BLANK
> USE
>
>
> USE testdbf
> TOTAL ON mydate TO testtotal
> USE
>
>
> REMOVE TABLE testdbf
> CLOSE DATABASES
> DELETE FILE testdbc.*



Re: Expression Evaluator Failed in TOTAL ON command by Bernhard

Bernhard
Thu Oct 13 04:49:30 CDT 2005

Hi Fred

> You can't TOTAL a date field. Try doing TOTAL ON myinteger TO testtotal
I did not test it, but why should it not work? The ON field is the grouping
field, not the field(s) that will be totaled.

From VFP 9 help:
TOTAL TO TableName ON FieldName [FIELDS FieldNameList] [Scope]
[FOR lExpression1] [WHILE lExpression2] [NOOPTIMIZE]

Parameters
...
FieldName
Specifies the field on which the totals are grouped. The table must be sorted on
this field, or an open index or index tag must have this field as its key
expression.

FIELDS FieldNameList
Specifies the fields to be totaled. Separate the field names in the list with
commas. If you omit the FIELDS clause, all numeric fields are totaled by default.


Regards
Bernhard Sander

Re: Expression Evaluator Failed in TOTAL ON command by Fred

Fred
Thu Oct 13 10:15:46 CDT 2005

Then what is it it's trying to TOTAL if you don't tell it? What if you had
12 integer fields, 3 other numerics, etc.?

--
Fred
Microsoft Visual FoxPro MVP


"Bernhard Sander" <fuchs@individsoft.de> wrote in message
news:u%23HHqt9zFHA.3756@tk2msftngp13.phx.gbl...
> Hi Fred
>
>> You can't TOTAL a date field. Try doing TOTAL ON myinteger TO testtotal
> I did not test it, but why should it not work? The ON field is the
> grouping field, not the field(s) that will be totaled.
>
> From VFP 9 help:
> TOTAL TO TableName ON FieldName [FIELDS FieldNameList] [Scope]
> [FOR lExpression1] [WHILE lExpression2] [NOOPTIMIZE]
>
> Parameters
> ...
> FieldName
> Specifies the field on which the totals are grouped. The table must be
> sorted on this field, or an open index or index tag must have this field
> as its key expression.
>
> FIELDS FieldNameList
> Specifies the fields to be totaled. Separate the field names in the list
> with commas. If you omit the FIELDS clause, all numeric fields are totaled
> by default.
>
>
> Regards
> Bernhard Sander



Re: Expression Evaluator Failed in TOTAL ON command by Bernhard

Bernhard
Thu Oct 13 14:00:33 CDT 2005

Hi Fred,

> Then what is it it's trying to TOTAL if you don't tell it? What if you had
> 12 integer fields, 3 other numerics, etc.?

I did not test it, but according to the already quoted VFP help:

TOTAL TO TableName ON FieldName [FIELDS FieldNameList] [Scope]
[FOR lExpression1] [WHILE lExpression2] [NOOPTIMIZE]

Parameters
...
FIELDS FieldNameList
Specifies the fields to be totaled. Separate the field names in the list
with commas. If you omit the FIELDS clause, all numeric fields are totaled
by default.

hth

Regards
Bernhard Sander

RE: Expression Evaluator Failed in TOTAL ON command by Greg

Greg
Thu Oct 13 23:23:31 CDT 2005

The problem is with the field trigger. If this is removed an error doesn't
occur

Its almost as if the total to file thinks it has a field trigger


Greg


"Greg" wrote:

> I think there is a bug in TOTAL command when there is a field rule expression.
>
> Am i doing something wrong
>
> Greg
>
>
> See the code below:-
>
> CREATE DATABASE testdbc
> lcproc="PROCEDURE mydate_valid"+CHR(13)+"RETURN .T."
> STRTOFILE(lcproc,'myproc.txt')
> APPEND PROCEDURES FROM myproc.txt
>
> CREATE TABLE testdbf (mydate D CHECK mydate_valid(),myinteger i)
> APPEND BLANK
> USE
>
>
> USE testdbf
> TOTAL ON mydate TO testtotal
> USE
>
>
> REMOVE TABLE testdbf
> CLOSE DATABASES
> DELETE FILE testdbc.*

Re: Expression Evaluator Failed in TOTAL ON command by Fred

Fred
Fri Oct 14 01:49:53 CDT 2005

To tell the truth, I've never used the TOTAL command, I've always used SQL -
SELECT to create SUM() values when I need them. Maybe this would work
better for you?

SELECT SUM(f1) AS sumf1, SUM(f2) AS sumf2, etc... FROM yourtable WHERE
condition INTO ...

--
Fred
Microsoft Visual FoxPro MVP


"Greg" <Greg@discussions.microsoft.com> wrote in message
news:89E88E46-260A-46D5-8264-518FA48C5B73@microsoft.com...
> The problem is with the field trigger. If this is removed an error
> doesn't
> occur
>
> Its almost as if the total to file thinks it has a field trigger
>
>
> Greg
>
>
> "Greg" wrote:
>
>> I think there is a bug in TOTAL command when there is a field rule
>> expression.
>>
>> Am i doing something wrong
>>
>> Greg
>>
>>
>> See the code below:-
>>
>> CREATE DATABASE testdbc
>> lcproc="PROCEDURE mydate_valid"+CHR(13)+"RETURN .T."
>> STRTOFILE(lcproc,'myproc.txt')
>> APPEND PROCEDURES FROM myproc.txt
>>
>> CREATE TABLE testdbf (mydate D CHECK mydate_valid(),myinteger i)
>> APPEND BLANK
>> USE
>>
>>
>> USE testdbf
>> TOTAL ON mydate TO testtotal
>> USE
>>
>>
>> REMOVE TABLE testdbf
>> CLOSE DATABASES
>> DELETE FILE testdbc.*