@DBColumn & @DbLookup Bug/Error!?

Very Very Weired. Here is the formula and unless I am missing something it seems to be a bug.

I have a view that has two columns. Column 1 has date and Column 2 has number. example data as below:

Column1 Column2

2/18/2008 100.00

2/19/2008 0.00

2/22/2008 -50.00

2/23/2008 500.00

sTotal:=@DbColumn(“”:“NoCache”;“”;“Adjustments”;2);

@If(@IsError(sTotal);0;@Sum(sTotal))

When formula is executed sTotal has values of 100;500 so Sum(sTotal) returns 600 when it should return 550.00

Please help.

Subject: @DBColumn & @DbLookup Bug/Error!!?

See the help on @Sum:Syntax

@Sum( numbers )

Parameters

numbers

Numbers or number lists. As many numbers or number lists as you want to sum.

Return value

result

Number. The sum of all the numbers, including members of number lists.

Usage

Make sure the fields you send as parameters contain a number value – Notes/Domino interprets empty number fields as the null string.

I WOULD LIKE TO EMPHASISE THE BIT BELOW:


Negative numbers in lists must be enclosed in parentheses.


"This example returns 11.

@Sum( (-1) : 2 ; (-10) : 20 )"

Subject: RE: @DBColumn & @DbLookup Bug/Error!!?

Ok,

I appreciate your post, but really do not understand your point. @DbLookup & DbColumn is returns a list and Sum is simply performing mathmetical operation on list returned. The issue is that DBlookup/Column is not returning all data as I showed in my example

Subject: RE: @DBColumn & @DbLookup Bug/Error!!?

What is the style setting on the 2nd column? “General”, or “Number”?

Subject: RE: @DBColumn & @DbLookup Bug/Error!!?

View columns do not have datatypes. The type of the value displayed in the column is totally dependent on the datatype returned by the column formula, which may be different on different rows. “Style” is not a property of the column; it’s a navigational control (despite that it appears to be “sticky”). You can change settings on all the different groups of style settings for the same column, and indeed it makes sense to do so, if you have no idea what the datatype of the result might end up being. It can have no bearing on this problem, since this is only about how the data are displayed, not what values are stored in the columns.

Generic Notes Developer’s idea that it might have something to do with placement of parenthesis around negative numbers is way off the mark. That’s just about operator precedence. If you’re not using the : and - operators in your code, not only does this not apply, there’s no conceivable way to apply it. Numbers do not contain parenthesis. Numbers are just numbers, expressed in binary, not containing any characters. We come back here to formatting settings, apparently – yes a column can be set to display numbers with parens around them, but that’s just the display. The value stored is the same no matter what display options you choose.

As for the original question, I tried and cannot reproduce it. Might there be more than one view with the name (or alias) “Adjustments”? Bear in mind that a folder name can also be used in an @Dbfunction, so a folder with that name might affect matters. Is there anything special about the two documents, that don’t show in the results, e.g. the user running the formula doesn’t have read access to them, or they are response documents or replication conflict documents? Is it possible to reproduce this issue using a very simple database containing just the one view and the four documents? (If not, I would look really really hard for a duplicate view or folder name.)

Subject: RE: @DBColumn & @DbLookup Bug/Error!!?

Thanks for correcting me on this. A long-held mis-impression based on foggy memories of my own past struggles with data types returned by @DbLookup.

Subject: RE: @DBColumn & @DbLookup Bug/Error!!?

I hear you… I am unable to find anything wrong …there are no views or folders or conflict records… I am going to create a new database and see if I can duplicate the problem… maybe its sometihng with OS or simply some really stupid mistake in code … i have no idea… this is driving me crazy. :frowning:

Subject: RE: @DBColumn & @DbLookup Bug/Error!!?

How did you verify the content of sTotal?

Subject: RE: @DBColumn & @DbLookup Bug/Error!!?

using a @prompt… as well as writing a value to field.

Subject: RE: @DBColumn & @DbLookup Bug/Error!!?

My point is simply that its expecting negative values in () and you are not putting them in brackets.Perhaps thats why it doesn’t work? Who knows what will happen when you feed it data it doesn’t like, perhaps it stops adding them up for example.

Try it with ().

Subject: @DBColumn & @DbLookup Bug/Error!!? *** FIXED **

I am an idiot… There was two different views which were named different but had same alias. one view only had documents selected where value was > 0 … all is working now…

damn… i feel stupid…

Thanks for everyone help!