Home » Developer & Programmer » Forms » Using 2nd table in execute_query
Using 2nd table in execute_query [message #476159] Tue, 21 September 2010 15:57 Go to next message
coolguy01
Messages: 64
Registered: August 2006
Member
I have a form screen based on a table say Table A. This screen is populated from a value selected on the previous screen. I take the value in the previous screen and create a onetime where clause and use the execute_query on table A to populate the screen. But what i need is if the value provided is not found in Table A then i have to look up an other table say table B and populate the screen based on Table B. Now how can i do it since the screen is based on Table A and if that value is not found i have to get values from the second table.


Thanks
Re: Using 2nd table in execute_query [message #476167 is a reply to message #476159] Tue, 21 September 2010 18:06 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
Do the tables in question have the same structure?

EDIT: typo

[Updated on: Tue, 21 September 2010 18:06]

Report message to a moderator

Re: Using 2nd table in execute_query [message #476171 is a reply to message #476167] Tue, 21 September 2010 19:08 Go to previous messageGo to next message
coolguy01
Messages: 64
Registered: August 2006
Member
Yeah have many similar columns but not the exact number of columns ... table A has a few more columns than table B.
Re: Using 2nd table in execute_query [message #476222 is a reply to message #476171] Wed, 22 September 2010 03:04 Go to previous message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
Three most obvious methods that spring to mind are:

1) Make the block a non-database block and populate from a cursor in when-new-form-instance. Normally I recommend against this but as long as you don't want to be able to modify the data it's probably the simplest way.
2) Create 2 datablocks. Have the items from one sit in the exact same place as the equivalent items from the other (or use two canvases if you prefer). Run a query in WNFI to see if there are matches in the first table. If there aren't make it's items invisible, go to the 2nd block and execute_query there.
3) Base block on procedure.

It might also be possible if you base the block on a parameterised view - seach asktom for examples of this (the views, you won't find anything specific on forms but once you've got a view returning data the way you want basing a block on it is easy).

I would suggest though that if the data from the 2 tables is that interchangable then they probably ought to be combined into 1 table.
Previous Topic: How can i generate PDF Report from Form Developer 6i.
Next Topic: Debugging a Form 10g
Goto Forum:
  


Current Time: Thu Sep 19 13:00:07 CDT 2024