Path: utzoo!attcan!uunet!husc6!bloom-beacon!tut.cis.ohio-state.edu!mandrill!hal!ncoast!allbery From: allbery@ncoast.UUCP (Brandon S. Allbery) Newsgroups: comp.databases Subject: Re: Informix Lookup Joins Message-ID: <7782@ncoast.UUCP> Date: 15 May 88 21:40:16 GMT References: <11983@shemp.CS.UCLA.EDU> Reply-To: allbery@ncoast.UUCP (Brandon S. Allbery) Followup-To: comp.databases Distribution: na Organization: Cleveland Public Access UN*X, Cleveland, Oh Lines: 46 As quoted from <11983@shemp.CS.UCLA.EDU> by marta@CS.UCLA.EDU: +--------------- | I'm want to do something similar to using "Lookup Joins" but that | allows modification of the data. | | When I make an entry into the *schedule* table using a screen form, | I want the s_title attribute to be set equal to the c_title attribute | for the corresponding course number, i.e.: | | if s_number = c_number then | s_title := c_title | | The effect should be that of providing default values for a field | (course title) depending on another field (course number). | As soon as the course number is entered in the table *schedule* | the course title is provided from the table *courses* | But, if the course title is not correct, I want to be able to modify it. | and store it in the table *schedule* (I do NOT want to modify | c_title). +--------------- We do this by creating a special screen of display-only fields after all the data entry screens; doing the "lookup joining" into the display-only fields on that screen; then using something like: before editadd editupdate of s_number let x001 = f022 after editadd editupdate of s_number if x001 != f022 then let f023 = x002 where "f023" is the s_title field and the lookup is coded like: f022 = s_number, lookup x002 = c_title joining *c_number; (This is Informix 3.3 syntax, it may vary slightly for Informix-SQL.) That lets us assign the initial s_title and then change it if we want. The save and test against the original value of f022 is needed so that the s_title isn't forced back to the c_title value when you press RETURN on the field without entering anything. -- Brandon S. Allbery, moderator of comp.sources.misc {well!hoptoad,uunet!marque,cbosgd,sun!mandrill}!ncoast!allbery Delphi: ALLBERY MCI Mail: BALLBERY