Re: SQL Master/Detail
Posted in 1993
I haven't noticed any answers to this question, but I may just not have been watching carefully enough -- and if I wasn't watching, I'm sorry for using bandwidth. >From: uunet!irl3b2c.att.com!bt >Date: Thu Jul 29 16:59:39 GMT 1993 >Subject: SQL Master/Detail >X-Informix-List-Id: <list.2560> >I am running Informix-SQL 2.10.03. Within PERFORM I have defined one table as >master of 4 others. This allows me to select Master/Detail relationships >from the PERFORM menu. I can enter "1d" to select the first detail table, >"2d" to select the second, etc., but I cannot determine how the order is >assigned. > It doesn't depend on the order in which the tables appear in the >TABLES section of the formspec. It seems - almost, but not quite - to follow >the inverse order of the "table a master of table b" statements in the >INSTRUCTIONS section. Has anyone any clues? And apologies in advance for >troubling the gurus with such a trivial question. The tables are assigned numbers in the order in which they first occur in the ATTRIBUTES section of the form, except that the DISPLAYONLY table (which is called Displaytable) is always last, regardless of where the first DISPLAYONLY field appears. The "almost inverse order" you observed is coincidence, which is why the "but not quite" applies. Given the form extract: TABLES tab01 = owner.thingamybob tab02 = whosit.thingamyjig tab03 = boss.widgetlist ATTRIBUTES f001 =*tab01.pkcolumn = tab02.fkcolumn, LOOKUP l001 = tab03.widgetname JOINING *tab03.widgetcode; The tables will be listed in the order tab01, tab02, tab03. But, change the attribute section to read: f001 = tab02.fkcolumn, LOOKUP l001 = tab03.widgetname JOINING *tab03.widgetcode; =*tab01.pkcolumn; and the order becomes tab02, tab03, tab01, and the default active table changes from tab01 to tab02. Oh, and I would not claim for a millisecond that the validation shown above is sensible (in the real world), but it illustrates the point about table order. Yours, Jonathan Leffler (johnl@obelix.informix.com) #include <disclaimer.h>