Page 1 of 1

[Solved] Need to add Base values in Writer Table Cell

Posted: Sat Oct 24, 2009 9:55 am
by gicoan
sorry for being noisy, but i have a problem that gets me crazy.
I have a mysql database registered with base.
I did a table of writer and connected some fields to cells of that table. i can perfectly print all documents.
But now I want to have a cell which must have as a value the sum of 6 cells.
I explain better.

In that table I have 6 cells which take value directly from db( they are integers) and i would like to have 7th cell which must be the sum of previous 6 cells. In sql it would be SELECT SUM(1+2+3+4+5+6) GROUP BY id.
How can I do?
Sorry, but perhaps I don't know something, because formula =sum<B1:B6> gives me an error in inserting formula (also = sum>B1:B6> does the same).
I'm getting crazy
Thanks

Title Edited. A descriptive title for posts helps others who are searching for solutions and increases your chances of a reply. (TheGurkha, Moderator)

Re: Need to add Base values in Writer Table Cell

Posted: Sat Oct 24, 2009 3:06 pm
by FJCC
I have never used formulas in Writer tables, so there may be a better way to do this. This works in a table I created.

Code: Select all

=sum(<B1>|<B2>|<B3>|<B4>|<B5>|<B6>)
I found this by clicking inside the table, going to Table -> Formula and using the function wizard that is becomes available on the formula bar that appears among the tool bars at the top.

Re: Need to add Base values in Writer Table Cell

Posted: Sat Oct 24, 2009 5:57 pm
by acknak
If you can do the calculation in a query, I would trust that more than using Writer's formulas, but that's just my opinion.

Anyway, using a table formula seems to work for me: =sum <B2:B4>

Here's a sample that uses the biblio database that comes with OOo.

To refresh the data, just open the database viewer (F4), navigate to the "biblio" table, select some rows and click the "Data to Fields" button.

Re: Need to add Base values in Writer Table Cell

Posted: Sun Oct 25, 2009 11:34 am
by gicoan
So much noise for nothing...sorry, I discovered it was easier than i thought: it was enough to give instructions to cells before connecting cells to database.Everything is fine,now.Sorry for my stupidity. :D