I’m creating a DB to keep records of investments. My tables are:
INVESTMENT: to name and describe the investment; its key is “StockAbbrev”.
TRANSACTION: for all transactions relating to the investments (like Buy, Sell, Dividend/Interest earned (both re-invested & cash varieties). Its key is an automated integer.
MARKET_PRICE: to store the market price/unit (share) on various dates. Its key is an automated integer. But I’d like to be able to ensure that there cannot be two or more quotes on the same date for any investment (not sure how to accomplish this). I’d need a key that’s like a concatenation of “StockAbbev”||“QuoteDate”, or something like first and second keys.
Three forms, so far, for manual data entry to each of these tables. These are working OK.
Aim is to eventually produce reports showing the overall portfolio, listing the investments, when they started, how much was put in (or taken out), how much each earned, and “current” worth based on latest QuoteDates in the MARKET_PRICE table.
Most calculations are based on figures in the transaction records. There are some cross-calculations (using figures in a transaction record and storing the result in another field of the same record.
I have a query that summarizes calculated figures for each investment. I’d like to store some of the summarized figures in the ‘upper’ table (i.e. INVESTMENT) so they’re visible when looking at the form for investment data entry. I hope these figures are refreshed (recalculated) every time I open the database! …or perhaps manually triggered to refresh while in the database.
Hope this explains why I want to be able to see the latest price and its quote-date for each investment (to calculate ‘current’ worth = total units X latest_price), and to pass this information to the investment’s record in the INVESTMENT table.
I will also want to get the date of the first transaction for each investment, and pass that to the invement’s record in INVESTMENT table. This indicates when the investment began.
I’m finding that when I have a calculated field in row, and give it an alias name, I can’t use that alias name in other calculations. I have to repeat the calculation’s SQL coding (which can be lengthy) in any other column where I need this result for the further calculation. Not sure of the purpose of alias names (though useful when the normal name cell is filled with SQL coding).
I worked (now retired) in IT for many years as a programmer (Autocoder, COBOL, bit of FORTRAN, SAS etc) and had a bit of experience with Microsoft Access. More recently, I’ve been using Apple’s FileMaker quite a bit which works fine but has a different approach than Access or Base.
I’ve used OpenOffice Spreadsheet for several years, but now I’d like to get familiar with Base and am using this investment thing as my first project (I developed a similar one in FileMaker, so my table design is similar to that). I was told that LibreOffice is perhaps better than OpenOffice, so here I am!
I’m not experienced in coding SQL, and haven’t found a good reference guide which spells out the syntax, and gives useful tips for various situations. I’ve been using ChatGPT quite a bit to look at my SQL coding to tell me what’s wrong with it (Base’s diagnostic messages are useless!). The AI is great at pointing out syntax errors and making suggestions with revised SQL coding. But their suggestions don’t always work in Base (“Syntax error” again!), so there’s a LOT of ‘trial & error’ attempts to get it working. It’s been taking up a LOT of time, and can be very frustrating.
So, I very much appreciate all the help I can get with this. THANKS to everyone who has pitched in with suggestions!!
There’s more yet to do with this project. I haven’t even begun on Reports. I want to make sure the underlying data is working as it should. I’ve got a ways to go with that!