lawhorn@optis31.uucp (Jeff Lawhorn) (06/12/89)
We have recently started using SQL*Forms. Now I have a question I hope someone out there can answer. I have 2 tables that I need to establish a master/detail relationship between. Much like the relationship between the orders table and the lineitems table in the Forms Tutorial. The big difference, and one I have not been able to overcome as of yet, is that I need to have the detail records displayed each and every time the master record is displayed. I do not (can not) want the user to have to switch blocks to call up the detail records. So, does anyone out there know of (or have any suggestions) a way to do this??? Thanks in Advance for any help anyone can send my way. -- Jeff Lawhorn lawhorn@opti opti!lawhorn@berick.uucp ucsd!sdsu!berick!opti!lawhorn
papegaai@eurtrx.UUCP (SKBS) (06/13/89)
lawhorn@optis31.uucp (Jeff Lawhorn) writes: >We have recently started using SQL*Forms. Now I have a question >I hope someone out there can answer. >I have 2 tables that I need to establish a master/detail >relationship between. Much like the relationship between the >orders table and the lineitems table in the Forms Tutorial. The >big difference, and one I have not been able to overcome as of >yet, is that I need to have the detail records displayed each and >every time the master record is displayed. I do not (can not) >want the user to have to switch blocks to call up the detail >records. >So, does anyone out there know of (or have any suggestions) a way >to do this??? >Thanks in Advance for any help anyone can send my way. >-- The solution I have been using is to provide all keys that cause changes in the master record (up/down, PgUp, PgDn etc.) with their own macros. All these macros do is to jump to the slave block, execute a query and return to the master block. The code looks like this: #EXEMACRO GOBLK [slave-block]; EXEQRY; GOBLK [master-block]; Provided you copy the value of the master block key-field to the slave-block foreign-key field, you will get the desired result. Bard C. Papegaaij BSO/Artificial Intelligence bv Stichting KBS "it can hardly be a coincidence that no language on Earth has ever produced the expression "as pretty as an airport"" Douglas Adams, The Long Dark Tea-Time of the Soul
peter@radig.UUCP (Peter Radig) (06/14/89)
In article <LAWHORN.89Jun12094256@optis31.uucp> lawhorn@optis31.uucp (Jeff Lawhorn) writes: >We have recently started using SQL*Forms. Now I have a question > >I have 2 tables that I need to establish a master/detail >relationship between. [stuff deleted] >I do not (can not) >want the user to have to switch blocks to call up the detail >records. Thats a quite nasty job to do and I think it's one of the most unsatisfying solutions in the ORACLE system. You have to redefine several Key-Triggers with the major objective of going into the detail block and retrieving the data whenever a new master block is displayed. So define in Master block: KEY-ENTQRY: #exemacro clrblk; goblk detail; clrblk; goblk master; entqry; goblk detail; exeqry; goblk master; KEY-EXEQRY: #exemacro exeqry; goblk detail; exeqry; goblk master; KEY-NXTREC: #exemacro nxtrec; goblk detail; clrblk; exeqry; goblk master; KEY-PRVREC: #exemacro prvrec; goblk detail; clrblk; exeqry; goblk master; Some information is provided by ORACLE in the SQL*Forms Release Notes Version 2.0 on page 48 (I definitely do not know why they put it under the Errata...). I hope with this information you're able to create your forms, don't hesitate to e-mail. -- Peter Radig Voice: +49 69 746972 USENET: peter@radig.UUCP or: uunet!mcvax!unido!radig!peter
tyers@trlluna.trl.oz (P Tyers) (06/15/89)
In article <LAWHORN.89Jun12094256@optis31.uucp>, lawhorn@optis31.uucp (Jeff Lawhorn) writes: > > I have 2 tables that I need to establish a master/detail > relationship between. Much like the relationship between the > orders table and the lineitems table in the Forms Tutorial. The > big difference, and one I have not been able to overcome as of > yet, is that I need to have the detail records displayed each and > every time the master record is displayed. I do not (can not) > want the user to have to switch blocks to call up the detail > records. > It is possible to do this quite easily (albeit with much key-trigger writing) in fact ORACLE even gives a (for ORACLE) lucid example. Check out SQL*Forms Reference manual (ours is Version 2.0 part # 3304-v2.0) section on trigger syntax (Chapter 9) Examples of SQL*Forms Triggers example 6 where they set up triggers to align header and detail records following use of [NEXT RECORD] key. Similiar actions need be taken as post_query on the master block, [PREV REC] etc. I have a number of forms doing this, even to the extent of aligning two detail blocks with the master block, but dont really want to clog the net with voluminous *.inp files. -- P Tyers, Tel. +61-(0)3-5416794 JANET tyers%trlluna.oz@uk.ac.ucl.cs ACSnet tyers@trlluna.oz UUCP {uunet,hplabs,ukc}!munnari!trlluna.oz!tyers CSnet tyers@trlluna.oz ARPAnet tyers%trlluna.oz@uunet.uu.net MAIL: Telecom Research Laboratories,P.O. Box 249,Clayton,VICTORIA 3168,AUSTRALIA
citron@cit-vax.Caltech.Edu (Mark C. Citron) (07/23/89)
In article <LAWHORN.89Jun12094256@optis31.uucp> lawhorn@optis31.uucp (Jeff Lawhorn) writes: > >I have 2 tables that I need to establish a master/detail >relationship between. Much like the relationship between the >orders table and the lineitems table in the Forms Tutorial. >Thanks in Advance for any help anyone can send my way. >-- >Jeff Lawhorn >lawhorn@opti >opti!lawhorn@berick.uucp >ucsd!sdsu!berick!opti!lawhorn Jeff, There is a cute trick you can use to create master detail relationships without hardly any typing at all. Before you start making the form with sqlforms let easysql create the initial form. It can add all the triggers you need for a good master/detail organization. Of course you are out of luck if you dont have easysql for if you have already start the form since modifying it with easysql will mess up your formatting. If you have already started it, you can create a two column form with easysql and just review the triggers it puts in. There seem to be the same as those already mentioned in other replies to your questions although it does add a few new tricks like jumping to the first or last row of the detail depending on the direction you are going in the master. It all works fine as far as I can tell. Contact me if I can be of more help. Mark Citron citron@csvax.caltech.edu citron@cit-vax.caltech.UUCP