Home » Developer & Programmer » Forms » Record Groups and Alerts (Oracle Form Builder 10g)
Record Groups and Alerts [message #600637] Sun, 10 November 2013 03:40 Go to next message
jgjeetu
Messages: 373
Registered: July 2013
Location: www.Orafaq.com/Forum
Senior Member

I have made a form and there is deptno and the item type for that deptno is List Item
and type is Combo Box , My requirement is i want to fetch all deptno in that combo box
for that i have created on record group i.e deptlist and created trigger for that
i.e
declare
	a number;
begin
	a:=populate_group('deptlist');
	clear_list('emps.deptno');
	populate_list('emps.deptno','deptlist');
	end;


1.But it is not displaying deptno list in combo box , according to me
everything is correct . Is there any solution.
2. I have created two alerts exiting and deleting
it asks me confirmation to delete or exit the form.
My requirement is i want to make only one alert for delete , save and exit
and for that i want to display different messages . please tell how to do that.

(Kinldy download attachments and in possible then provide corrected .fmb file )
Thanks

  • Attachment: emps_pic.fmb
    (Size: 140.00KB, Downloaded 1079 times)
Re: Record Groups and Alerts [message #600641 is a reply to message #600637] Sun, 10 November 2013 06:57 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
Dear i was little busy that's why i could'nt chk your mail.


declare
	cursor tdeptno is select deptno from dept;
	king number(5):=0;
begin
	for i in tdeptno
	loop
		king:=king+1;
		add_list_element('list5',king,i.deptno,i.deptno);
	end loop;
end;
		


Regard
Mughal
  • Attachment: list.fmb
    (Size: 48.00KB, Downloaded 1137 times)
Re: Record Groups and Alerts [message #600642 is a reply to message #600641] Sun, 10 November 2013 07:06 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
And here is you fmb is corrected

Re: Record Groups and Alerts [message #600647 is a reply to message #600642] Sun, 10 November 2013 12:52 Go to previous messageGo to next message
jgjeetu
Messages: 373
Registered: July 2013
Location: www.Orafaq.com/Forum
Senior Member

thats ok Smile n thanks mughal bro but i think by mistake you provided wrong .fmb file beacuase there are many errors in this fmb file which i corrected.
1. if you will run this .fmb file then you will get error on popup window i.e frm-41334 invalid record group for popultaion.
reason:-
add_list_element('list5',king,i.deptno,i.deptno);

correction:-
add_list_element('deptno',king,i.deptno,i.deptno);

(bcoz item name is deptno which is list_item combo_box)

=> now you will get same error but not on popup, only in taskbar.
reason:- You forgot to delete when_new_form_instance trigger on form level

=> now you will get no error now click on deptno list_item, there are duplicate values
reason :- because earlier i manually entered values in deptno list_item and you forgot to
clear that list thats why it is showing duplicate values:-
solution:-
declare
	cursor tdeptno is select deptno from dept;
	king number(5):=0;
begin
	clear_list('emps.deptno');
	for i in tdeptno
	loop
		king:=king+1;
		add_list_element('deptno',king,i.deptno,i.deptno);
	end loop;
end;


Now form is working perfectly, now no error.

Now my question begins
In last code you have created a cursor tdeptno which is fetching all deptno values from dept table.
after that you created varibale king which is number type and size is 5 ,
after that you used for loop which is fetching values from tdeptno cursor ,
but i am not able to understand this syntax:-
king:=king+1;
		add_list_element('deptno',king,i.deptno,i.deptno);( explain this code also)

kindly explain this code n whats the use of creating king variable and how the size of king variable
i.e 5 is affecting the query. because i created 6 record in dept table and it is showing all 6 deptno
so i am getting confused so please explain.

Meanwhile i took form online_help and got this but sill facing problem

PROCEDURE ADD_LIST_ELEMENT(list_name VARCHAR2, list_index, NUMBER,list_label VARCHAR2, list_value VARCHAR2);
PROCEDURE ADD_LIST_ELEMENT(list_id ITEM, list_index VARCHAR2, list_label VARCHAR2, list_value VARCHAR2);

list_id:-  Specifies the unique ID that Oracle Forms assigns when it creates the list item. Use the FIND_ITEM built-in to return the ID to an appropriately typed variable. The data type of the ID is ITEM. 
list_name:-  The name you gave to the list item when you created it. The data type of the name is VARCHAR2. 
list_index:-  Specifies the list index value. The list index is 1 based. 
list_label:-  Specifies the VARCHAR2 string that you want displayed as the label of the list element. 
list_value:-  The actual list element value you intend to add to the list item. 


and question related to alerts still stands, Explain that also.
Thanks

[Updated on: Sun, 10 November 2013 13:08]

Report message to a moderator

Re: Record Groups and Alerts [message #600650 is a reply to message #600647] Sun, 10 November 2013 15:01 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
jgjeetu wrote on Sun, 10 November 2013 12:52
thats ok Smile n thanks mughal bro but i think by mistake you provided wrong .fmb file beacuase there are many errors in this fmb file which i corrected.
1. if you will run this .fmb file then you will get error on popup window i.e frm-41334 invalid record group for popultaion.
reason:-

add_list_element('list5',king,i.deptno,i.deptno);


Quote:

add_list_element('deptno',king,i.deptno,i.deptno);

(bcoz item name is deptno which is list_item combo_box)
Quote:

reason :- because earlier i manually entered values in deptno list_item and you forgot to
clear that list thats why it is showing duplicate values:-


Quote:

Now my question begins
after that you created varibale king which is number type and size is 5 ,
after that you used for loop which is fetching values from tdeptno cursor ,
but i am not able to understand this syntax:-


Quote:

king:=king+1;
add_list_element('deptno',king,i.deptno,i.deptno);( explain this code also)

kindly explain this code n whats the use of creating king variable and how the size of king variable
i.e 5 is affecting the query. because i created 6 record in dept table and it is showing all 6 deptno
so i am getting confused so please explain.

Quote:

and question related to alerts still stands, Explain that also.


Dear first of fall i always uploading fmb when i checked properly with me it is 100% 2ndly have you checked my list fmb i did not define any trigger regarding when-new-form-instance i just simply pick data from table "deptno" and added into list item by using cursor "Add_list_element yes may be i forgot to change in your fmb which is "emps_pic_corrected.fmb" and sorry about that as far as concern CURSOR let me explain first little things about CURSORS what is cursor?

There are different types of cursors but Let me explain about these 3 cursors

(A)Implicit cursor (B)Explicit cursor
(Handle by oracle) (user defined)

Steps:
Declare
Open
Fetch
Close

every query that we issue on a database is an implicit cursor for EXAMPLE select,update, Delete etc.

IMPLICIT CURSOR oracle uses a cursor for every select..into statement that is not referenced by an explicit cursor. it also uses cursors for all insert, update, or delete statement that it processes these are called implicit cursors.


EXPLICIT CURSOR is a user defined cursor. Cursor are PL/SQL objects builtin upon SELECT statements that allow you to better manipulate queries records returned by quries.

CURSOR <cursor_name> IS <select_statement>;


CURSOR VARIABLE :- in the examples used so far the select statement that populates a

cursor with data is specified when the cursor is declared meaning that if two or more program units need to manipulate data from the same cursor each of them will have to declare, open,fetch and close the cursor. cursor can be declared and manipulated like any other PL/SQL variable the cursor variables.

NOW little bit about "Add_list_element"?

You can add list elements by adding elements one at a time or by populating a list item with values contained in a record group.

You can add values to a list item by using these built-in subprograms:

ADD_LIST_ELEMENT built-in :- adds a single element to a list item.

POPULATE_LIST built-in :-

Removes the contents of the current list and populates the list with the values from a record group.the record group must be created at runtime and it must have the following two column (VARCHAR2) structure: Column 1:the list label :column 2: the list value.

Now let me explain what is "KING" variable which i defined and why?.


king:=king+1;--what this king variable doing---simple adding(Creating) rows,1,2,3,4....;in list5 item

FRM-41334: "Invalid record group for list population" You tried to populate a list from a record group that does not exist.


Now dear friend upload your fmb with table structure i shall check thoroughly hope its not that much problem you are just confusing.

Dear if you are having a problem with creating recordgroup then take this example how to do this.

create table test(tst_id number,tst_name varchar2(25));
insert into test values(1,'mirror');
insert into test values(2,'Table');
insert into test values(3,'Speaker');
commit;

---WHEN-NEW-FORM-INSTANCE---

DECLARE
       GROUP_ID   RECORDGROUP;
       LIST_ID    ITEM := FIND_ITEM('mughal');
       STATUS NUMBER;
BEGIN
       GROUP_ID := FIND_GROUP('TYP');
    IF NOT ID_NULL(GROUP_ID) THEN
        DELETE_GROUP(GROUP_ID);
       ELSE
        GROUP_ID := CREATE_GROUP_FROM_QUERY
       ('TYP','SELECT tst_name,TO_CHAR(tst_id) FROM test');
END IF;
STATUS := POPULATE_GROUP('TYP');
POPULATE_LIST(LIST_ID,GROUP_ID);
END;


Hope you got something about cursors, add_list_elements and record_group


Regard
Mughal


[Updated on: Sun, 10 November 2013 16:43]

Report message to a moderator

Re: Record Groups and Alerts [message #600652 is a reply to message #600650] Sun, 10 November 2013 17:01 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
sorry Dear i forgot to answer about your 2nd question regardng msg alerts actually due to heavy work load, stress as well Sad i am a little confuse Laughing anyway it is about 03:00 morning/night
see u tommo.

Regard
Muhal

[Updated on: Sun, 10 November 2013 17:02]

Report message to a moderator

Re: Record Groups and Alerts [message #600654 is a reply to message #600652] Sun, 10 November 2013 17:31 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
Take your answer of 2nd question regarding msg alert now i am dead tired Smile rest of discussions tommo.


Regard
Mughal
Re: Record Groups and Alerts [message #600800 is a reply to message #600654] Tue, 12 November 2013 11:32 Go to previous messageGo to next message
jgjeetu
Messages: 373
Registered: July 2013
Location: www.Orafaq.com/Forum
Senior Member

@mughal bro kindly check my mail , its urgent.
Re: Record Groups and Alerts [message #600810 is a reply to message #600800] Tue, 12 November 2013 14:30 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
Dear i have answered of your all questions please check you email

Regard
Mughal.
Re: Record Groups and Alerts [message #600811 is a reply to message #600810] Tue, 12 November 2013 14:39 Go to previous messageGo to next message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Guys, please don't do that.

If you want to communicate via e-mails, do so, but don't use this forum as a pinboard. Absolutely nobody (but you) benefits from what you say to each other behind the curtain.
Re: Record Groups and Alerts [message #600812 is a reply to message #600811] Tue, 12 November 2013 14:50 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
Sorry Sir @littlefoot next time it will not happened.

Regard
Mughal

Re: Record Groups and Alerts [message #600836 is a reply to message #600811] Wed, 13 November 2013 00:53 Go to previous message
jgjeetu
Messages: 373
Registered: July 2013
Location: www.Orafaq.com/Forum
Senior Member

sorry littlefoot but whatever i discussed with him through mails that was reltaed to ocp exams
n he was guiding me only , otherwise i post my queries here only , but this will not happen again for sure .
Thanks Smile
Previous Topic: called form is opening behind the calling form in oracle form
Next Topic: why it showing messages like this?
Goto Forum:
  


Current Time: Tue Apr 23 05:30:50 CDT 2024