Wiki
Clone wikiMoneydance / Objects
Home>Moneydance>Objects
Moneydance Objects
First read Traversing the Data for information about the main objects. The information here is about the other objects.
AccountBook/AccountBookModel
The AccountBook holds details of the current file and where it is located within the file system. There are a number of methods to manipulate the files.
AccountBookModel is the collection of AccountBooks, this is the list of files you see in the File menu.
Accounts
All types of Accounts are held in the same structure (see Traversing Data). There is a subclass of the Account class for each type of Account, these are:
- AssetAccount
- BankAccount
- CreditCardAccount
- InvestmentAccount
- LiabilityAccount
- LoanAccount
- SecurityAccount
In addition the Income and Expense categories are also held as Accounts. This allows transactions to be standardized, i.e. a transfer between two or more accounts.
The two classes are: * ExpenseAccount * IncomeAccount
The RootAccount is also a subclass of Account.
JDateField/CustomDateFormat
JDateField is a general object for entering a displaying dates.
You set the date format when you create the JDateField by passing an instance of CustomDateField. JDateField will put up a picker for the date when clicked on. You can enter the date but it must be in the precise format as the CustomDateFormat.
The format of dates is not defined in the documentation but using the normal dd, /, mm and yyyy seems to work.
Transactions
The transactions within your file are accessed via the root account as shown in Traversing the Data. Typically a transaction will have a ParentTxn transaction and one SplitTxn. However, some transactions, such as Investment Dividend or Miscellaneous income/expense have two. What transactions are needed needs to be investigated using a tool such as the File Display extension. In addition you need to look at the Tags generated by Moneydance as if you miss these when creating transactions it will cause problems.
To create a transaction you need to:
- Create ParentTxn
- Create SplitTxn(1 or mote)
- Add SplitTxn(s) to the ParentTxn with
#!Java parentTxn.addSplit(splitTxn);
#!Java txnSet.txnModified(parentTxn);
A few examples of transactions are given below:
1. Investment Dividend
A Dividend transaction has two splits.
- Parent - TXN : Dividend amount against the Investment Account holding the security
- Split - TXN 1 : Dividend amount against the Investment Income category where you wish to record dividend
- Split - TXN 2 : A zero amount transaction against the Security Account that received the dividend.
You need to set the Transfer Type to TRANSFER_TYPE_DIVIDEND with:
#!Java txn.setTransferType(AbstractTxn.TRANSFER_TYPE_DIVIDEND);
Split TXN 1 has a Tag with key AbstractTxn.TAG_INVEST_TYPE, value AbstractTxn.TAG_INVEST_INC Split TXN 2 has a Tag with key AbstractTxn.TAG_INVEST_TYPE, value AbstractTxn.TAG_INVEST_SEC
using :
#!Java splitTxn1.setTag(AbstractTxn.TAG_INVEST_TYPE, AbstractTxn.TAG_INVEST_INC); splitTxn2.setTag(AbstractTxn.TAG_INVEST_TYPE, AbstractTxn.TAG_INVEST_SEC);
2. Investment income/expense
Same as Dividend though the Transfer Type is TRANSFER_TYPE_MISCINCEXP and the Account on Split TXN 1 is the income/expense category as required.
Updated