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

Writing a book, Automating Document Production - Discuss your special needs here
Post Reply
gicoan
Posts: 2
Joined: Sat Oct 24, 2009 9:44 am

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

Post 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)
Last edited by Hagar Delest on Sun Oct 25, 2009 11:36 am, edited 1 time in total.
Reason: Tagged as solved
Openoffice 3.1 on linux ubuntu 9.04
FJCC
Moderator
Posts: 9248
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Need to add Base values in Writer Table Cell

Post 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.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Need to add Base values in Writer Table Cell

Post 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.
Attachments
db_calc.odt
(8.42 KiB) Downloaded 196 times
AOO4/LO5 • Linux • Fedora 23
gicoan
Posts: 2
Joined: Sat Oct 24, 2009 9:44 am

Re: Need to add Base values in Writer Table Cell

Post 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
Post Reply