[Solved] Formulas in OpenOffice base..

Discuss the database features
Post Reply
bogo
Posts: 5
Joined: Thu Jul 17, 2008 11:48 am
Location: piatra neamt/romania

[Solved] Formulas in OpenOffice base..

Post by bogo »

Which version of OpenOffice.org are you using? 2.3
What Operating System (version) are you using? XP (at work), Kiwi Linux (at home)
What is your question or comment? (scroll down)...

Hey everyone...this is my first time here and a have a few questions...actually one...HOW IN GOD'S NAME CAN I ADD FORMULAS IN A BASE TABLE, THE CONTENTS OF WICH IS VIEWED WITH THE HELP OF A FORM, and offcource the formulas be working... :(

For example... Field A - Filed C = (Field B / 100)*19%+11,52 IF Field E = Field D AND Field F=100 units

....weird formula...i know...i just made that up :D

the point is that i have a field, let's say "target" and another one that says "procent of target achieved". to get to the value of "target" i have to add, multiply and IF the inputed values do match to a certain value, everything's ok and "procent of target" can be calculated; the rezulted value beeing equal to a procent of the "target" field.

now...i've looked over some tutorials over then net, searched this forum, and google for that matter, but all my searches turn out nothing...you guys have any advice for me? :?

if any additional info is necesarry I'll be glad to share it ... :D

thanks in advance... :?
OOo 2.3.X on Ms Windows XP + Kiwi Linux 8.04
User avatar
Villeroy
Volunteer
Posts: 31363
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Formulas in OpenOffice base..

Post by Villeroy »

Create query in SQL...

Code: Select all

SELECT *, ("Field B" / 100)*0.19 + 11,52 AS "Calculated"
FROM "XTable"
WHERE ("Field E" = "Field D") AND ("Field F"=100)
Doublequotes denote names of tables and fields.
The * stands for "all the fields in the specified table(s)".
FROM specifies the source-table(s) of a query.
AS "Calculated" adds a label to the calculated fields.
A WHERE clause works like a filter.

90% of all databases and 100% of all common relational databases use more or less the same SQL (Structured Query Language). It is by far more easy to learn SQL than learning how to do anything in Base, Access, whatever.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Formulas in OpenOffice base..

Post by acknak »

Welcome!

As far as I know, you have two choices:
• Use a spreadsheet to store your data table. You can use formulas in a column and the result of the calculation will be the value in the database table.
• Use a standard SQL query expression, something like SELECT (TargetA+TargetB)/Total FROM Table to do the calculation.

The first method works the way you seem to expect; the second is the standard way of working with a database.

You may need to do some reading on the fundamentals of using a database, since OOo Base essentially provides an access layer over standard database technology and concepts.

If you have further, more specific, questions about Base, you'll probably want to post them in the Base forum.
AOO4/LO5 • Linux • Fedora 23
Safway
Volunteer
Posts: 347
Joined: Thu Apr 24, 2008 4:35 pm

Re: Formulas in OpenOffice base..

Post by Safway »

If your question is simply "Can I use logical operators in Base" (notice I did not yell with the capitals nor did I use the Lord's name in vain), then yes I believe you can. It depends upon the functionality of your database you are using.

Generally, you first create a query with your choice of logical operators and then you create the form from the query.

Notice in HSQL (the database behind OO.o Base) you can use logical operators on joins
http://hsqldb.sourceforge.net/web/changelog.html
http://www.hsqldb.org/doc/guide/guide.html

Here is a basic base report how to create base reports using calculations
http://searchenterpriselinux.techtarget ... 96,00.html
http://openoffice.blogs.com/openoffice/ ... alcul.html

Maybe here is a more what you are looking for?
http://www.oooforum.org/forum/viewtopic.phtml?p=291990
http://wiki.services.openoffice.org/wik ... rt_Builder
http://wiki.services.openoffice.org/wik ... /Functions
http://user.services.openoffice.org/en/ ... &sk=t&sd=a
http://searchenterpriselinux.techtarget ... 24,00.html
http://wiki.services.openoffice.org/wik ... Procedures

Attached is a graphic taken from one of the above URIs.
Attachments
Group_Report_Totals.gif
If someone posts a fix for your question, then please post a quick thank you and then go to your first post, use the edit button to add [Solved] as the first word of the title so other people can rely on the fix as well.
LibreOffice 3.3.3 on Fedora
bogo
Posts: 5
Joined: Thu Jul 17, 2008 11:48 am
Location: piatra neamt/romania

[Solved] Formulas in OpenOffice base...

Post by bogo »

Thanks for sharing the "procedure" with me ... you guys helped me alot! :D
OOo 2.3.X on Ms Windows XP + Kiwi Linux 8.04
Post Reply