Home » Developer & Programmer » Forms » Create Master form and detailed form problems -help
Create Master form and detailed form problems -help [message #360275] Thu, 20 November 2008 04:32 Go to next message
mnenchev
Messages: 6
Registered: October 2008
Junior Member
Hi all. Can you give me example about this:
I have a db table PERSONS with PERSONID, NAME, TOWNID, SMOKER(true/false or 0/1) and table TOWNS with columns TOWNID, TOWNNAME

So i want to have one master(general) form that shows in tabular view general information about all persons i.e. personId and name.
When i double click on some person row from the table i want to show detailed form about the person in form view i.e. person name, smoker(as checkbox) town(as listbox that was populated with all towns from db table TOWNS) and the town of the selected person is selected in the list.
In the master form it has to have add and edit(edit is like double click on the row) buttons. And in the detailed form it has to have save button that updates or inserts.

Please upload me some example forms or give me tutorials or post me.
Thanks.
Best regards
P.S. you could also send me mail: god_like_@abv.bg
Re: Create Master form and detailed form problems -help [message #360283 is a reply to message #360275] Thu, 20 November 2008 04:56 Go to previous messageGo to next message
Littlefoot
Messages: 20888
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Regarding number of columns, I don't see an urge to create a simple master-detail form, not to mention TWO forms! Those 4 items (personid, name, townname, smoker) can more than easily fit one tabular form. It would enable you to do whatever you want with these values (if you have required privileges, of course).

The only "non-default" piece of coding would/might be creating a list of values for "town" values. Otherwise, I really think you shouldn't complicate such a straightforward form.
Re: Create Master form and detailed form problems -help [message #360295 is a reply to message #360283] Thu, 20 November 2008 05:47 Go to previous messageGo to next message
mnenchev
Messages: 6
Registered: October 2008
Junior Member
Well i am quite new to oracle forms, and my app is not focused on it(i use bean that do some stuff with the form fields from java). This forms are just as example that shows that the bean stuff works. I am trying to do the forms but every thing is messed up.
Here is some pl/sql that do this:
DECLARE
	nDummy NUMBER;
	a Varchar(50);
BEGIN
       DEFAULT_VALUE(NULL, 'GLOBAL.PERSONID');
       IF :GLOBAL.PERSONID IS NOT NULL THEN
       SET_BLOCK_PROPERTY('PERSONS_DETAILS', ONETIME_WHERE, 'PERSONID=' || :GLOBAL.PERSONID);
       GO_BLOCK('PERSON_DETAILS');
       EXECUTE_QUERY;
       :GLOBAL.PERSONID:=NULL;
       END IF;

	CLEAR_LIST('PERSONS_DETAILS.TOWNS');
	nDummy:=POPULATE_GROUP('RG_TOWNS');
	POPULATE_LIST('PERSONS_DETAILS.TOWNS', 'RG_TOWNS');
	for i in 0.. GET_LIST_ELEMENT_COUNT('PERSONS_DETAILS.TOWNS') loop
		a := Get_List_Element_Value('PERSONS_DETAILS.TOWNS', i );
		if to_char(:GLOBAL.PERSONID) = Get_List_Element_Value('PERSONS_DETAILS.TOWNS', i ) then
			:PERSONS_DETAILS.TOWNS := Get_List_Element_Value('PERSONS_DETAILS.TOWNS', i ) ;
		end if;
	end loop;
END;

PERSONID is global and is initialized in the master form. In that way i transfer the person id in the detailed form. After that i try to populate all fields, and finally try to populate the list with all towns and in the loop to set the town for the person(but this dont work).
I dont think this is very regular and i would like to help me please.
[EDITED by DJM: applied [code] tags]

[Updated on: Sun, 23 November 2008 23:57] by Moderator

Report message to a moderator

Re: Create Master form and detailed form problems -help [message #360761 is a reply to message #360295] Mon, 24 November 2008 00:00 Go to previous message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Just have a xecond block in your form, in its default_where point to the first block. When you doble_click on the row go to this second block which is on a second canvas which will pop-up automatically, do an 'execute_query' and use a 'post-query' with a 'select' to get the town name.

David
Previous Topic: WebUtil - MailMerge
Next Topic: scrolling data
Goto Forum:
  


Current Time: Fri Dec 02 14:14:26 CST 2016

Total time taken to generate the page: 0.06243 seconds