OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Calculations and Lead-In Record

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base
View previous topic :: View next topic  
Author Message
mixt
Newbie
Newbie


Joined: 04 May 2012
Posts: 2

PostPosted: Fri May 04, 2012 7:51 pm    Post subject: Calculations and Lead-In Record Reply with quote

So I'm working on a self proposed project of sorts. My professor doesn't quite understand the concept of a relational database and deemed a textbook example wrong simply because it was One-to-Many instead of One-to-One. That was an easy hurdle but there is some manipulation of data I don't get, and might not be possible in OOo.

So the idea is that we start with an Inventory table [Product Number, Current Stock] and a Shipment table [Order Number, Product Number, Shipment Date, Quantity] and query (or otherwise produce) a table showing the projected inventory [Date, Received Deliveries, Projected Stock]. This means...
1) I need a line showing what is currently in stock, but that doesn't correspond to any incoming shipment.
2) I need to calculate what the stock would be based off of that days deliveries and the projected stock of the previous (including the dummy record of point one.

Are those possible in OOo, or would this require some sort of exporting to a program that can? I mean I could probably build an overly simplistic Java program to make a CSV table how I need it to look.
Back to top
View user's profile Send private message
dacm
Super User
Super User


Joined: 07 Jan 2010
Posts: 734

PostPosted: Fri May 04, 2012 8:25 pm    Post subject: Reply with quote

Is this for a grade at school? Probably not going to get specific help on that here. Here's some links to help your research:
http://www.oooforum.org/forum/viewtopic.phtml?p=476347
http://www.oooforum.org/forum/viewtopic.phtml?p=467524
_________________
Soli Deo gloria
Tutorial: avoiding data loss with Base + Migrating 'Embedded databases'
Back to top
View user's profile Send private message
mixt
Newbie
Newbie


Joined: 04 May 2012
Posts: 2

PostPosted: Fri May 04, 2012 8:30 pm    Post subject: Reply with quote

Not for a grade, no. It just annoyed me that he called the textbook wrong so casually, and since I've disagreed with him on other things in the class I wanted to see if he was right about this. I figured the best way to show the textbook as being correct would be to reproduce the example. If I show him this it is about as likely to piss him off as it is going to do my any favors.
Back to top
View user's profile Send private message
caravas
General User
General User


Joined: 05 Sep 2011
Posts: 31

PostPosted: Sat May 05, 2012 4:31 am    Post subject: Reply with quote

Well,

Let me see if I got your point:

You need a query to sum your stock and future stock according to your shipment delivery table, using a textbox to set a specific date?

Try something like this:

Code:
SELECT ”ProductTable”.“Product Number”, SUM(”ProductTable”.“Current Stock”) AS PRESENTSTOCK, (SELECT SUM("ShipmentTable"."Quantity") FROM "ShipmentTable" WHERE( ”ProductTable”.“Product Number” =  ”ShipmentTable”.“Product Number” AND ”ShipmentTable”.“Shipment Date” <= ?)) AS FORECASTDELIVERY, (SUM(”ProductTable”.“Current Stock”) + ISNULL((SELECT SUM("ShipmentTable"."Quantity") FROM "ShipmentTable" WHERE( ”ProductTable”.“Product Number”  =  ”ShipmentTable”.“Product Number” AND ”ShipmentTable”.“Shipment Date” <= ?)),0)) AS TOTALONTHATDAY FROM “ProductTable” GROUP BY ”ProductTable”.“Product Number” ORDER BY ”ProductTable”.“Product Number” ASC


You must to use this SQL code, that I believe it will works nicely, straight on SQL query design on Base. Do not use the query constructor, it will mess the SQL code. I've never used this kind of SQL in embedded databases, which I presume is your case.
You might want to create a form based on this query, and with some back code, you will be able to fill up the date value and requery your database.
Look out about date standards of hsqldb: “yyyy-mm-dd”!!

Regards.
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group