Here's a Master-Detail-Example extracted from one of my solutions. It works by filtering the master- and the detail-table by generating dynamic SQL-queries. All calculation-fields, script-trigger-calculations and scripts are as much as possible generic, so it should be integrable to your own solutions. There's a HowTo and a integration-guide included.
I'd like to hear your comments.