Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using form property as control source for text box
Message
 
 
À
15/03/2005 17:28:57
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00996098
Message ID:
00996153
Vues:
40
>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
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform