Home » Developer & Programmer » Forms » to change source table at runtime (oracle,10g,windows xp pro)
to change source table at runtime [message #324257] Sun, 01 June 2008 03:23 Go to next message
sd_md_rizwan@yahoo.com
Messages: 37
Registered: September 2007
Location: Saudi Arabia
Member

please tell me how can i change the source table at runtime with an example, the situation is, i have 3 table with same structure, and i created 3 radio buttons and if i click radio button 1 i want the data from table1, and if i click radio button 2 then i want the data from table2 in the same fields like wise 3, please help me
Re: to change source table at runtime [message #324265 is a reply to message #324257] Sun, 01 June 2008 04:45 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
As far as I can tell, you can't do that.

However, you might create a view as UNION of these tables (include additional "table" identifier column which you'll use in a form (radio button)).
Re: to change source table at runtime [message #324271 is a reply to message #324265] Sun, 01 June 2008 05:14 Go to previous messageGo to next message
esraa90
Messages: 63
Registered: May 2008
Location: EGYPT
Member
Or you can build three canvases.

each one based on its table.

i.e canvas1 based on table1, canvas2 based on table2 ,....

then when using radio buttons switch between those canvases.

display one and hide the others.
Re: to change source table at runtime [message #324296 is a reply to message #324257] Sun, 01 June 2008 13:22 Go to previous messageGo to next message
urnikhil
Messages: 42
Registered: March 2008
Member
Or else you can try using when-radio-changed trigger... Add logic to this trigger in such a way that it populates those text fields based on the selected radio button...

your text fields by default will be based on the table corresponding to your default button...

When user changes the radio button value, the trigger fires and updates those values based on the radio button...

- Nik.
Re: to change source table at runtime [message #324302 is a reply to message #324296] Sun, 01 June 2008 21:42 Go to previous messageGo to next message
wency
Messages: 450
Registered: April 2006
Location: Philippines
Senior Member

Have you tried changing Query Data Source of that block using set_block_property?
Re: to change source table at runtime [message #324322 is a reply to message #324302] Mon, 02 June 2008 00:30 Go to previous messageGo to next message
sd_md_rizwan@yahoo.com
Messages: 37
Registered: September 2007
Location: Saudi Arabia
Member

yes i tried Query Data Sourde but not succeded, can you give the example for SET_BLOCK_PROPERTY of QUERY_DATA_SOURCE_NAME so that i can check my coding if there is anything wrong,
please ..
Re: to change source table at runtime [message #324337 is a reply to message #324322] Mon, 02 June 2008 01:24 Go to previous messageGo to next message
wency
Messages: 450
Registered: April 2006
Location: Philippines
Senior Member

have a look at these:
http://www.orafaq.com/forum/t/53596/0/
http://www.orafaq.com/forum/t/53427/0/
Re: to change source table at runtime [message #324572 is a reply to message #324337] Tue, 03 June 2008 03:33 Go to previous message
mailtokkalyan
Messages: 65
Registered: December 2006
Location: Bangalore
Member
hi,
you can do this using on insert trigger.

On-Insert (block level) If :Control_Block.Radia_button='emp' Then
Insert Into emp(emp_code,name)values(:emp.emp_code,:emp.name);
Elsif :Control_Block.Radia_button='emp1' Then
Insert Into emp1(emp_code,name)values(:emp.emp_code,:emp.name);
Else
Insert Into emp2(emp_code,name)values(:emp.emp_code,:emp.name);
End If;

Pre_Query (block Level)
if :Control_Block.Radia_button='emp' then
set_block_property('emp',Query_data_source_name,'emp');
elsif :Control_Block.Radia_button='emp1' then
set_block_property('emp',Query_data_source_name,'emp1');
else
set_block_property('emp',Query_data_source_name,'emp2');
end if;

this will work...if required chk the attachment.(attachment form will have 3 tables temp_t1,temp_t2,temp_t3 Instead of emp1,emp2,emp2.
  • Attachment: temp_form.fmb
    (Size: 52.00KB, Downloaded 906 times)
Previous Topic: querying a particular record based on date function
Next Topic: Retriving Record from Another Table
Goto Forum:
  


Current Time: Fri Sep 27 12:22:59 CDT 2024