dbTalk Databases Forums  

VFP 9: SQL: sum() of Zero Items

comp.databases.xbase.fox comp.databases.xbase.fox


Discuss VFP 9: SQL: sum() of Zero Items in the comp.databases.xbase.fox forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Gene Wirchenko
 
Posts: n/a

Default VFP 9: SQL: sum() of Zero Items - 11-13-2006 , 12:31 PM






Some of my code just broke under 9.

Is there an easy workaround to that VFP 9 sums 0 rows to .null.?

I have a statement report that accumulates a balance forward from
transactions. If there are none, then the total should be zero.
Instead, it sums to .null. I think that this is very silly.

I can patch this quickly enough, but there could be other similar
surprises waiting, so I would like a more general solution.

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.

Reply With Quote
  #2  
Old   
Dan
 
Posts: n/a

Default Re: VFP 9: SQL: sum() of Zero Items - 11-13-2006 , 01:19 PM






I use NVL() to translate null values to 0 or "".


"Gene Wirchenko" <genew (AT) ocis (DOT) net> wrote

Quote:
Some of my code just broke under 9.

Is there an easy workaround to that VFP 9 sums 0 rows to .null.?

I have a statement report that accumulates a balance forward from
transactions. If there are none, then the total should be zero.
Instead, it sums to .null. I think that this is very silly.

I can patch this quickly enough, but there could be other similar
surprises waiting, so I would like a more general solution.

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.



Reply With Quote
  #3  
Old   
Lew Schwartz
 
Posts: n/a

Default Re: VFP 9: SQL: sum() of Zero Items - 11-13-2006 , 02:10 PM



You have to go with Dan's suggestion. SQL distinguishes between any non-zero
number of rows with a 0 sum and no rows at all. They're not the same and
it's the programmers job to handle the difference between the two.
-Lew
"Gene Wirchenko" <genew (AT) ocis (DOT) net> wrote

Quote:
Some of my code just broke under 9.

Is there an easy workaround to that VFP 9 sums 0 rows to .null.?

I have a statement report that accumulates a balance forward from
transactions. If there are none, then the total should be zero.
Instead, it sums to .null. I think that this is very silly.

I can patch this quickly enough, but there could be other similar
surprises waiting, so I would like a more general solution.

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.