Issue 25879 - Apparent insufficent form programming ability
Summary: Apparent insufficent form programming ability
Status: CLOSED NOT_AN_OOO_ISSUE
Alias: None
Product: Base
Classification: Application
Component: code (show other issues)
Version: OOo 1.1
Hardware: PC Windows XP
: P3 Trivial (vote)
Target Milestone: ---
Assignee: marc.neumann
QA Contact: issues@dba
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-02-26 03:51 UTC by keybounce
Modified: 2006-05-31 14:29 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description keybounce 2004-02-26 03:51:18 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.
Comment 1 Frank Schönheit 2004-02-26 05:55:41 UTC
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.
Comment 2 marc.neumann 2004-04-27 12:00:14 UTC
close