Subject Re: Total on in dbase 8.0
From Mervyn Bick <invalid@invalid.invalid>
Date Wed, 7 Oct 2020 14:57:14 +0200
Newsgroups dbase.getting-started

On 2020/10/07 13:35, Akshat Kapoor wrote:

>> set fields to typetota =
>> ltrim(str(year(received)))+ltrim(str(month(received)))+testtype
>> set fields to numbers,received,testtype
>
> Good Evening Rouke,
> I have never used dbase 8 and a little out of touch with xdml
> hence cannot say with confirmation
>
> BUT
>
> In the above statements typetota is a string.
> And how can you expect to total a string field.

TYPETOTA is a calculated character field and it is used to create a
complex index for the table.  It is used to order the rowset and does
not affect the aggregation of all numeric fields in the actual table.
See the help file for TOTAL.

The problem here is that the month value can be 1 or 2 characters.
Variable length index expressions are a definite no-no.


>
> set fields to typetota =
> val(ltrim(str(year(received)))+ltrim(str(month(received)))+testtype)
>
> may solve your problem.

For a complex index all the individual elements must be converted to a
common type.  For practical purposes this means they must all be of
character type.

Mervyn.