1
votes

I'm building a Master-detail form in Oracle Apex.

There should be only a limited number of detail records for each master record; upto 4 detail records.

I can build a database trigger to ensure this business rule, but those error messages aren't displayed nicely in Apex (or even on the same page).

Is there a way to build an Apex validation to count and limit the number of detail records on a master-detail form?

1

1 Answers

0
votes
  • Use a page level validation to count the number of records and display an error if required. A PLSQL function returning a boolean or error text will both work fine in achieving this.

  • Use error handling to intercept the errors in order to display a user friendly message. This involves a bit more work but once you've got this up and running it'll be easily customised and ported over to other applications. You can find a tutorial on Patrick Wolf's blog (one of the apex dev team; there is a part 1 and 2).