Sergey
After ranting in another thread, I can now see where it does make the code simplier. I have read a lot on VFP9, but guess I didn't read far enough as this one totally slipped by me.
Thanks ever so much. To use lone practioniers out here, you are our beacon of hope and a great resource.
Thanks for all you do on UT.
Gaylen
>>Sergey
>>
>>You are correct as always, it was not the property being a control source that was the problem but rather the property having a null value.
>>
>>In the code below:
>>In VFP9
>>The variable lnarTotalc evaluates out to .null. as the _tally value is 1
>>
>>In VFP8
>>The variable lnarTotalc evaluates out to 0 as the _tally value is 0
>>
>>There is only one billing record in cur_ar and and no payments so it does not meet the where clause yet the _tally say 1.
>>
>>
>*** get total collected
>>Select Sum(prem+expc+teri+late_fee+penalty);
>> from cur_ar Where Left(Alltrim(ar_type),1) == "C" Into Array arTotalc
>>If _Tally = 0
>> lnarTotalc = 0
>> ELSE
>> lnarTotalc = artotalc
>>Endif
>>
>As a result in VFP8 I get a zero value and in VFP9 I get a null value.
>>
>>I guess the question is why is the _tally count 1 in VFP9 when there was not a record that met the where criteria?
>
>Gaylen,
>
>The _TALLY after a query holds the number of records in the result not the number of record matching the query criteria. In VFP9 a query with aggreagate function, like SUM()/ MAX()/e.t.c, without GROUP BY clause returns a single record with all nulls as required by ANSI SQL standard. It's documented in SET ENGINEBEHAVIOR help topic. It actualy makes your code simplier.
SELECT NVL(SUM(prem+expc+teri+late_fee+penalty),0) ;
> FROM cur_ar WHERE LEFT(ALLTRIM(ar_type),1) == "C" ;
> INTO ARRAY arTotalc
>lnarTotalc = arTotalc
>