[v1 V4WS] Does SUM work on ULong fields?
Ruslan Zasukhin
sunshine at public.kherson.ua
Wed Nov 15 02:02:57 CST 2006
On 11/15/06 1:32 AM, "Steven Ronald" <stevenrt39 at yahoo.com.au> wrote:
Hi Steven,
> Ruslan,
>
>> I not remember such problem in v1.
>> Should work.
>
>> May be you have NULLs ?
>
> I opened the database up with VAPP and can see each
> field is populated with data for the 62 records, so it
> can't be because I am trying to SUM nulls. It seems to
> work OK for Double, not for Ulong fields.
>
> Anyway, I believe all the fields I need to SUM are
> Double so it is not a problem for me.
>
> However, assuming I am using SUM only on Double
> fields, what happens if I use SUM when no records are
> found? I tested a few times and it gives 0 which makes
> sense, but I am nervous about relying on this default
> behaviour.
>
> To be safe I can do this:
>
> cursorRef=valSQLSelect( dbRef_xdb, "SELECT SUM(roop),
> COUNT(roop) FROM x WHERE foo<5")
>
> If valgetfield(cursorRef,2)=0 then
> sum=0
> else
> sum=valgetfield(cursorRef,1)
> end if
>
> Is this necessary? Or can I just use
>
> cursorRef=valSQLSelect( dbRef_xdb, "SELECT SUM(roop)
> FROM x WHERE foo<5")
>
> sum=valgetfield(cursorRef,1)
>
> and if no records are found assume I will always get
> sum=0?
>
> Which is better?
Second. I do not see reason why you afraid ZERO result.
--
Best regards,
Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc
Valentina - Joining Worlds of Information
http://www.paradigmasoft.com
[I feel the need: the need for speed]
More information about the Valentina
mailing list