Apache OpenOffice (AOO) Bugzilla – Issue 25879
Apparent insufficent form programming ability
Last modified: 2006-05-31 14:29:06 UTC
I attempted to create a database form for entering financial transactions. A simple system as follows: Account table: AccountID, Name, Description Transaction Summaries Table: TransactionID (unique), Amount, AccountID, Memo Transaction lines table: LineID, TransactionID (non-unique), AccountID, AMount, Memo And, I wanted to enforce the constraint that the sum of the amounts in the transaction lines table for the currently selected transaction summary was 0. Eventually, I'd also have the first line being positive and equal to the amount in the summary table, but for now I'd just settle for simple double entry balancing. Nothing that I could find would do this. Nothing in the basic programming interface seems to permit actions being taken when a new record is put into a database form, nor even to validate data before it gets sent to the database. There was no way, for example, to add up the totals in the amounts (example: a single line of 100, or one line of 100 and a second of -60), and make adjustments (forcing a second line with a value of -100, or a third line with - 40). Nor was there any way to ensure that the linking ID fields would match.
Try binding a macro to the "Before record action" event of the form (mark a control, and select "Form..." from the context menu) as follows Function approveRowChange( oEvent as Object ) as Boolean If ( everthingsOkay ) Then approveRowChange = TRUE Else approveRowChange = FALSE End If End Function See http://api.openoffice.org/docs/common/ref/com/sun/star/sdb/XRowSetApproveListener.html#approveRowChange for a description of the method. In other words: provided that I understand your intentions correctly, you can always do what you want -> resolving INVALID.
close