Popups and 2 part keys (OpenInsight 32-Bit)
At 05 APR 2007 05:57:24PM David Nicol wrote:
I have a file with a 2 part key. In the form, I can set up a search using a popup on the first part of the key using a file that has a single key but I'm trying to come up with a way to pass the results of the first popup on to the second popup so that it will search the file for all records where the first part of the key matches the result of the first popup. The application is Property Management. The first popup displays a list of properties and allows 1 to be selected. The second popup I want to search the unit file which has as a key property*unit but I only want the units for the property that was selected in the first popup. Any ideas how I might do this?
Dave
At 05 APR 2007 10:14PM Barry Stevens wrote:
…set up a search using a popup on the first part of the key using a file that has a single key…
Using the key returned from the first popup, select the units from the 2nd file using {property}=selectedsinglekey, then populate the popup with the results.Property s/b btree'd
btw: if relational indexing was used, then the population would be faster.
Property*unit -] Property
Please excuse me if I have missunderstood something
At 06 APR 2007 05:10PM David Nicol wrote:
Thanks for the response Barry. The 1st popup is ok. The code is:
declare function Repository
repos_key=@appid:'*POPUP**Property_POPUP'keys=Repository('EXECUTE', repos_key, @WINdow)if keys then.Property-]text=keys.@User1-]text=keysCall Send_Event(@window, 'READ')EndRETURN 0
What I'm having trouble with is how to get the key to the second popup which is this:
declare function Repository
repos_key=@appid:'*POPUP**Unit'keys=Repository('EXECUTE', repos_key, @WINdow)if keys then.Unit-]text=keysCall Send_Event(@window, 'READ')EndRETURN 0
At 06 APR 2007 08:39PM Barry Stevens wrote:
declare function popup
popupname=UNIT"
typeoverride='
typeoverride=PropertyId
Keys=Popup (window, typeoverride, popupname)
if keys then
.Unit-]text=keys
Call Send_Event(@window, 'READ')
End
RETURN 0
At 19 APR 2007 04:33PM David Nicol wrote:
This is the code for the search event:
*declare function Repository
declare function Popup
$INSERT POPUP_EQUATES
typeoverride='
typeoverride=CONDOUNIT"
typeoverride=BY UNIT WITH PROPERTY EQ " :{Property}
typeoverride=T"
Keys=Popup(@Window, typeoverride, popupname)
* repos_key=@appid:'*POPUPUnit' * keys=Repository('EXECUTE', repos_key, @WINdow, typeoverride) * keys=Repository('EXECUTE', repos_key, @WINdow) if keys then .Unit-]text=keys Call Send_Event(@window, 'READ') End RETURN 0 When I run it, I get the error message "ENG0012: RTP27 Line 1 Table has not been opened" I have tried several variations and can't get it to work. What am I missing? </QUOTE> —- === At 19 APR 2007 06:06PM Warren Auyong wrote: === <QUOTE>Maybe try DEFPROP instead of TEXT? </QUOTE> —- === At 19 APR 2007 06:16PM David Nicol wrote: === <QUOTE>I get the same result with DEFPROP </QUOTE> —- === At 20 APR 2007 06:18AM The Sprezzatura Group wrote: === <QUOTE>David It would help if you could debug the code to indicate WHERE your errors are coming from. To do this you'd be better off to call a subroutine rather than use an event handler. However the RTP27 file has not been opened is a strong indicator that the problem lies with the {} syntax and so is PROBABLY linked to your select statement. The Sprezzatura Group World leaders in all things RevSoft
</QUOTE> —- === At 20 APR 2007 02:28PM David Nicol wrote: === <QUOTE>The code that shows in Debugger - RTP27 Call Stack is: RTP27 $$$PROPERTY*Click*ENTER_CONDOUNIT.BUTTON_2 RUN EVENT </QUOTE> —- === At 20 APR 2007 02:46PM The Sprezzatura Group wrote: === <QUOTE>Mixed case "Click"? The Sprezzatura Group World leaders in all things RevSoft
</QUOTE> —- === At 20 APR 2007 03:58PM David Nicol wrote: === <QUOTE>Poor typist. "CLICK" </QUOTE> —- === At 20 APR 2007 04:49PM The Sprezzatura Group wrote: === <QUOTE>OK does the CLICK event do any {COLUMN} logic? The Sprezzatura Group World leaders in all things RevSoft
</QUOTE> —- === At 20 APR 2007 08:09PM Barry Stevens wrote: === <QUOTE>:{Property} Is the DICT file open </QUOTE> —- === At 24 APR 2007 04:25PM David Nicol wrote: === <QUOTE>The code to search the CONDOUNIT file for units within a particular PROPERTY is an event from a button on the CONDOUNIT entry/edit form. I would think that the dict file is open. </QUOTE> —- === At 25 APR 2007 03:52PM The Sprezzatura Group wrote: === <QUOTE>@Dict is not loaded by default in OI. The Sprezzatura Group World leaders in all things RevSoft
</QUOTE> —- === At 30 APR 2007 04:28PM David Nicol wrote: === <QUOTE>Thanks for the help. This is what worked for me. *declare function Repository declare function Popup $INSERT POPUP_EQUATES OPEN "DICT", "CONDOUNIT" TO @DICT ELSE NULL popupname=UNIT" typeoverride=' *typeoverride=CONDOUNIT" typeoverride=WITH PROPERTY EQ ":{PROPERTY} *typeoverride=T" Keys=Popup(@Window, typeoverride, popupname) * repos_key=@appid:'*POPUPUnit'
* keys=Repository('EXECUTE', repos_key, @WINdow, typeoveride)
* keys=Repository('EXECUTE', repos_key, @WINdow)
if keys then.Unit-]TEXT=keysCall Send_Event(@window, 'READ')EndRETURN 0
At 01 MAY 2007 10:46AM Bob Carten wrote:
David:
I prefer send Lostfocus to the control instead of sending read event to window. In opther words, instead of
Keys=Popup(@Window, typeoverride, popupname)
if keys then
.Unit-]TEXT=keysCall Send_Event(@window, 'READ')End
try
Keys=Popup(@Window, typeoverride, popupname)
if keys then
.Unit-]Defprop=keysCall Send_Event(@window:'.UNIT', 'LOSTFOCUS')End
This code is well behaved for a single part key, or if changing one part of a multi-part key, or if changing a prompt which is not a key.
At 01 MAY 2007 02:08PM David Nicol wrote:
I copied the code from your message and tested it. From the form, the popup displayed and I made a selection, but the selected unit from the popup did not display back on the form. I went back to the way it was and then when a selection is made the results go back to the form. I have a button on the form "Search"